• Hi,

    in my child theme’s functions.php I tried to apply a filter to hide certain posts that belong to a travel guide I’m working on, I tried to use this code here:

    function excludeMetaKey($query) {
    
      if ( $query->is_home && $query->is_feed && $query->is_main_query() ) {
    
          $query->set('meta_key=mappress&meta_value=ns');
       }
    return $query;
    }
    
    add_filter('pre_get_posts', 'excludeMetaKey');

    Unfortunately it is not working.
    Any hints what I’m doing wrong?

    Many thanks in advance.
    Cheers
    Yogie

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘exclude posts from blog and feed’ is closed to new replies.