Include Custom Post Types in WordPress Search
By George Nicolaou
Custom content such as projects or resources can be valuable in search results. First decide which content visitors should find and whether its public detail pages are useful.
Check the post-type configuration
Review its public visibility and search exclusion settings. A post type intended only for internal data should not become searchable just because another public post type needs inclusion.
Target the intended query
If code modifies the search query, scope it to the front-end main search rather than every query. Administrative screens, navigation modules and unrelated loops should keep their existing behaviour.
Verify the results template
Search for a term that appears in the custom content and inspect the title, excerpt and destination. Check empty results and pagination. Archive and category queries are separate cases; including a type in search does not automatically give it taxonomy archives.
This recording demonstrates the earlier approach. Treat its configuration as project-specific and review the current post-type registration before adapting it.
0 Comments