WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using query-wrangler, similar to drupal's views, I created some query pages. When I visit these pages, in the top-navigation-menu there is this warning:

Warning: in_array() expects parameter 2 to be array, null given in /.../wp-includes/nav-menu-template.php on line 425

The line cited by the warning is inside the ancestral post object wich I fully report here:

// ancestral post object
    'post_type' == $parent_item->type &&
    ! empty( $queried_object->post_type ) &&
    is_post_type_hierarchical( $queried_object->post_type ) &&
    in_array( $parent_item->object_id, $queried_object->ancestors ) &&
    $parent_item->object != $queried_object->ID
) ||

Line 425 is the one starting with in_array( The top-navigation-menu items are not related with the query pages. Are simple pages, some of them childpages. I really don't know how to fix this warning, because I don't understand to what is related.

share|improve this question
It seems that $queried_object->ancestors is returning NULL. Maybe just check this statement before, and if it IS returning NULL don't use it as second arguemnt in in_array but use array(). – tfrommen Mar 8 '13 at 12:42
The problem is that the plugin is doing something very wrong. I don't know how it works, but checking "something" somewhere, where it isn't supposed to exist, shows a lack of design and concept. Maybe better change the plugin. But: Did you tell the developer in the official support form about it? – kaiser Mar 10 '13 at 19:52
Hi tf and @kaiser. There is a report in the support forum here that describe a similar issue. Actually I don't understand wich part of code of query-wrangler plugin produce this situation. A sort of workaround could be to hide the warning because everything else work in the menu. But it's not a good practice (I'll lose also other warnings). Sorry for duplicated comment – Kropot Mar 11 '13 at 0:41
@Kropot You can any time delete a comment. Hover over it, tick the small x. – kaiser Mar 11 '13 at 1:16
Well, support is a privilege, not a right :) From the plugin page: Last Updated: 2013-1-5, so I'd say file a bug report and wait until he got time... – kaiser Mar 18 '13 at 18:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.