This PHP code once added to the end of your child themes functions.php file excludes all pages from inclusion in the search results when using the native WordPress search function.
The code below only excludes an array of specific post I.D’s from the search results.
Hello is it possible to do the opposite of this fix? I want pages that are restricted to “subscribers” to be hidden from the search results for non logged-in users, but become visible in the search results for logged-in subscribers. I’m using the Metro Pro Theme along with the UserPro plugin. Any suggestions?
Hi Brian. Try adding the PHP not operator to the conditional tag like this