I added a custom post type to my site, and I used this code to get the items to show up in archive pages:
if (
( is_tag() || is_category() )
&& $query->is_main_query()
&& empty( $query->query_vars[‘suppress_filters’] )
) {
// Get all your post types
$post_types = get_post_types();
$query->set( 'post_type', $post_types );
return $query;
}
}
add_filter( 'pre_get_posts', 'add_custom_types_to_tax' );
But I have a megamenu built in to my theme that loads articles from categories, and it’s not displaying the items from the custom post type. How can I get megamenu to query my custom post types? Is there are a is_menuquery() that I could add to the code above to make it work? I know I’m probably not providing enough info and I should just go to the developer of the theme, but I figured I’d just take a shot in the dark to see if anyone had any ideas. Thanks!
The topic ‘Query Custom Post types via MegaMenu’ is closed to new replies.