Support » How-To and Troubleshooting » nav_menu_items showing in Recent Posts

nav_menu_items showing in Recent Posts

  • Hi,

    I have added custom post types to my theme. So that these cpt’s shouw up when browsing by ‘category’ and ‘tag’ I have added the following code to my functions.php

    function query_post_type($query) {
      if(is_category() || is_tag() ) {
        $post_type = get_query_var('post_type');
    	$post_type = array('post', 'photo', 'photo365', 'nav_menu_item');
    	    $post_type = $post_type;
    	    $post_type = array('post', 'photo', 'photo365'); // replace cpt to your custom post type
    	return $query;

    but the widget that shows the recent posts, shows the recent 8 posts which I ask for, but this also inludes the ‘nav_menu_item’ which is a type of post.

    Now, I need ‘nav_menu_item’ in the code above so that the nav menu is displayed in the header, without I get a blank nav menu.

    How do I stop the nav_menu_items showing in the recent posts? I can’t believe that I am the only one with this issue, and it’s driving me nuts!



Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘nav_menu_items showing in Recent Posts’ is closed to new replies.
Skip to toolbar