How To Limit Search Results For Specific Post Types in WordPress

Have you ever wondered how you can limit your search results to specific post types? Its not very hard. We’ve already showed you how to disable the search feature in WordPress by modifying the functions.php file. Now we’re going to do the same thing except to filter our search results.

Open your functions.php file and add the following codes:

Tables can't be imported directly. Please insert an image of your table which can be found here.

1 2 3 4 5 6 7 8 9 10      

Notice the line that says

Tables can't be imported directly. Please insert an image of your table which can be found here.

1

You can filter the search results by changing the values in the array variable. Right now it is set to display posts and pages but you can modify it to display anything you want.

Was this article helpful?
0 out of 0 found this helpful