Skip to main content

You always can use pre_get_postspre_get_posts or posts_where hooks (you can find documentation on Codex)posts_where hooks.

Here you have an example of using pre_get_postspre_get_posts to exclude some posts from search results: http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_Pages_from_Search_Results

It's better solution, because you won't make another, redundant SQL query.

You always can use pre_get_posts or posts_where hooks (you can find documentation on Codex).

Here you have an example of using pre_get_posts to exclude some posts from search results: http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_Pages_from_Search_Results

It's better solution, because you won't make another, redundant SQL query.

You always can use pre_get_posts or posts_where hooks.

Here you have an example of using pre_get_posts to exclude some posts from search results: http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_Pages_from_Search_Results

It's better solution, because you won't make another, redundant SQL query.

Source Link
Krzysiek Dróżdż
  • 25.5k
  • 9
  • 53
  • 74

You always can use pre_get_posts or posts_where hooks (you can find documentation on Codex).

Here you have an example of using pre_get_posts to exclude some posts from search results: http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_Pages_from_Search_Results

It's better solution, because you won't make another, redundant SQL query.