Warning message "Warning: in_array() expects parameter 2 to be array, null given
-
The site I am working on has many pages with many menus. I currently have the parent pages and their ancestors showing the pertinent menu according to code in the sidebar.php and the following function:
// Check if page is an ancestor function is_ancestor($post_id) { global $wp_query; $ancestors = $wp_query->post->ancestors; if ( in_array($post_id, $ancestors) ) { return true; } else { return false; } }
My news page (where posts are displayed) is a child of About. When I try to call the About Menu as per the rest of the site I get the following warning:
Warning: in_array() expects parameter 2 to be array, null given in /Users/…./functions.php on line 138
I am working locally so unfortunately I cannot provide a link to the site.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Warning message "Warning: in_array() expects parameter 2 to be array, null given’ is closed to new replies.