PHP function causes menu change
-
I have a function to hide events in the category “Private” on the archive page:
/* Hide Private categeory events*/
function hide_eo_private_pre_get_posts( $query ) {
if (
! is_admin() && is_post_type_archive(‘event’)
) {
$tax_query = array(
‘post_type’ => ‘event’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘event-category’,
‘field’ => ‘slug’,
‘terms’ => ‘private’,
‘operator’ => ‘NOT IN’,
),
),
);
$query->set( ‘tax_query’, $tax_query );
}
}
add_action( ‘pre_get_posts’, ‘hide_eo_private_pre_get_posts’ );Which works. But then it puts a bunch of random pages in the site’s main navigation. I’m not a PHP expert so I’m hoping this is obvious to someone.
The page I need help with: [log in to see the link]
The topic ‘PHP function causes menu change’ is closed to new replies.