• Resolved THP Studio

    (@thpstock)


    Hey,

    Just installed and it worked great! I get that it has minimal settings (which is want we want) but I just need one thing – to be able to exclude certain pages/posts based on page ID.

    Is that possible? Really don’t want to upgrade to the much heavier version just for that one thing.

    Thanks

    Tim

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Sure, you can do that: WP_Query has the parameter post__not_in for that. See WP_Query documentation.

    add_action( 'pre_get_posts', function( $query ) {
      if ( $query->is_search() ) {
        $query->set( 'post__not_in', array( 1, 2, 3 ) );
      }
    } );
    Thread Starter THP Studio

    (@thpstock)

    Hi Mikko,

    That’s fantastic, thanks for pointing me in the right direction.

    Regards

    Tim

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude posts’ is closed to new replies.