Title: Works but undefined index notice
Last modified: January 17, 2020

---

# Works but undefined index notice

 *  [WP Academic](https://wordpress.org/support/users/eastsidecode/)
 * (@eastsidecode)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/works-but-undefined-index-notice/)
 * If running PHP 7+, you can get an undefined index notice on line 408 of class-
   heirary.php.
 * A better way of defining $post_types_to_hide on line 408 would be to do the following:
 *     ```
       /**
        *  Just create an empty array
        */
   
       $hideFromMenuFix = array();
   
       if (isset($this->settings['hidden_from_admin_menu'])) {
        $post_types_to_hide = array_intersect( $this->post_types, (array) $this->settings['hidden_from_admin_menu'] );
        } else {
        // if not set, use the blank array
        $post_types_to_hide = array_intersect( $this->post_types, (array) $hideFromMenuFix );
        }
       ```
   
 * Hope this helps!

The topic ‘Works but undefined index notice’ is closed to new replies.

 * ![](https://ps.w.org/hierarchy/assets/icon-256x256.png?rev=1029463)
 * [Hierarchy](https://wordpress.org/plugins/hierarchy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hierarchy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hierarchy/)
 * [Active Topics](https://wordpress.org/support/plugin/hierarchy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hierarchy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hierarchy/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [WP Academic](https://wordpress.org/support/users/eastsidecode/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/works-but-undefined-index-notice/)