• Howdy!

    I’m using this functions.php snippet to exclude category 41 from the WordPress homepage:

    function exclude_category_home( $query ) {
    if ( $query->is_home ) {
    $query->set( 'cat', '-41' );
    }
    return $query;
    }
    add_filter( 'pre_get_posts', 'exclude_category_home' );

    Then, on a profile page tab (WPUM plugin) I’m running this query:

    <?php
    $current_user = wp_get_current_user();
    $user_ID = $current_user->ID;
    	
    // The Query to show a specific Custom Field
      
    $the_query = new WP_Query( array( 'meta_key' => 'fetcher', 'meta_value' => $user_ID ) );
      
    // The Loop
    while ( $the_query->have_posts() ) : $the_query->the_post();
      
    the_title();
      
    endwhile;
     
    // Reset Post Data
    wp_reset_postdata();
      
    ?>
    

    My question: why is category 41 excluded in the resulting list of posts on the profile page?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Excluding a category on the frontpage’ is closed to new replies.