[SOLVED] Exclude page from Atahualpa search results
I found how to exclude ALL pages from search results by adding the code below to the functions.php editor, but I want to only exclude one or two pages from search results.
<?php function mySearchFilter($query) { if ($query->is_search) { $query->set('post_type', 'post'); } return $query; } add_filter('pre_get_posts','mySearchFilter'); ?> I've been unsuccessful trying to Google a solution, so could you please suggest some coding? thank you Tracy |
try 'wordpress exclude page from search'
|
Thank you.
One problem I had was where to post the coding. I was just copying it at the end of the edit file but now that I put it before the ?> it works. (probably obvious to coders, but not to me) I appreciate your time, Tracy |
All times are GMT -6. The time now is 03:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.