Support » Fixing WordPress » Links in nav menu disappearing on category pages

  • I’m using the following function to add custom post type posts to my archive pages loops, but when its added its removing the custom links from my category pages. ie. the links where i manually specify the title/address, and its only happening when viewing posts by category.

    This is the function:

    function namespace_add_custom_types( $query ) {
      if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
        $query->set('post_type', array('post', 'page', 'feed', 'news', 'fitness', 'faith'));
        return $query;
      }
    }
    add_filter( 'pre_get_posts', 'namespace_add_custom_types' );

    When I remove the function the custom post type posts disappear but the links return, so this function appears to be the culprit, but I’m not sure what to do from here.

    Can anyone point me in the right direction to getting back these links whilst viewing posts by category please?

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Links in nav menu disappearing on category pages’ is closed to new replies.