How to include specific custom post types in WordPress search results

Custom post types are not included in the WordPress search results by default – adding this snippet to you functions.php creates a function that allows specific custom post types to be queried and searched by WordPress.

Instructions
Add this to your functions.php file

Comments

2 Replies to “How to include specific custom post types in WordPress search results”

  1. Hello, This code is work but conflict with bbPress. I add to my functions.php and When I view the topic of bbPress it doesn’t show the content.

Leave a Reply

Your email address will not be published. Required fields are marked *

Snippet Info

Tested with Wordpress v. 4.8
Last Modified: 06.03.2018
Last Reviewed: 06.03.2018

How to include specific custom post types in WordPress search results
3.6 (72%) 5 vote[s]
Please report broken snippets.
Report Broken Snippet
WP Engine