Eliminate certain pages from the search results

Open
REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme January 31, 2020
Login to reply
Ignacio Santiago
3 weeks ago

I did it. Thanks.

//////////////////////////////////////////////////////////////////

// Eliminate from Search

//////////////////////////////////////////////////////////////////

add_action( 'pre_get_posts', 'my_search_exclude_filter' );

function my_search_exclude_filter( $query ) {

  if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {

    $query->set( 'post__not_in', array( 1083, 992, 331, 504, 7, 457, 8, 238, 3, 503, 1725, 1944 ) );

  }

}

Igor Sunz Support Agent
4 weeks ago

You can find a lot of information in Google how to do this for wordpress

пт, 31 янв. 2020 г., 14:54 Sizam Support Help Desk <
sizamtheme+YbXDP1ewDKlNjnMK0EWL@mail.support-hub.io>:

Ignacio Santiago
4 weeks ago

Is it possible?

Additional Info

Link on page with issue (Optional): https://estafados.red/