I have created a custom post type. It seems to work fine. I searched the following code to have the custom post types show within the other posts on the blog's front page:
//add custom post type to front page
add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
function add_my_post_types_to_query( $query ) {
if ( is_home() && $query->is_main_query() )
return;
$query->set( 'post_type', array( 'post', 'reviews' ) );
}
However, this one piece of code makes all my menu items disappear on all menus. I only have three menus: the main header menu, a footer menu, and a mobile menu. I do not have a lot of items at all.
When I removed the above code from functions.php
, the menu items re-appeared, but now my custom post type doesn't show on the front page.
Does anyone have any ideas why the code would cause the menu items to disappear?