By all rights it should work, here’s the same thing applied to my own site:
tomjn.com/?s=talk&post_type=tomjn_talks vs tomjn.com/?s=talk . Something else is the problem
Specifically, if you replace the main query with a query_posts call or a WP_Query, that query won’t take into account parameters passed via the URL unless explicitly passed through manually.
Instead, use the pre_get_posts filter to modify the main query, rather than creating a new query to replace it.This ensures any additional queries passed via the URL will also work, and reduces time spent querying the database significantly for a nice performance boost.
Additionally, if you already use pre_get_posts, setting the post_type will override the URL parameter, so you need to check for its existence
Related Posts:
- Include custom taxonomy term in search
- Searching multiple custom post types and pages
- AJAX search on post pages by custom post type
- How can I change the admin search posts fields?
- How to make a WP_Query search with custom post types?
- Development of a WordPress Search Plugin – Best Practices
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Simple way to search custom-post types only
- Pushing a custom post type to the top of the search results
- How do I Paginate Search Results for Custom Post Types?
- WordPress post sorting with AJAX
- Search that will look in custom field, post title and post content
- Returning search results by relevance, including Custom Post Types
- How to replicate some of Drupal Views functionality in WordPress?
- Seperating Custom Post Search Results
- Exclude from search all custom posts which are NOT in a taxonomy term
- Exclude a term of a taxonomy with a custom post type in a search
- Search everything (posts, pages, tags, cpt, meta)
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- filter search result with custom post type meta key
- Custom search for custom post type, custom meta and search fields
- How Do I Use WP_Query to Run This Database Query as Search Result?
- Custom Post Types: pretty search URLs and has_archive
- Search Post Title Only [duplicate]
- No results searching custom post type in admin panel
- custom search result page
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Customize Search Results for Custom Post Type
- multiple search forms and search results
- error in Advanced Search Form for Custom Post Types in WordPress array_key_exists() expects parameter 2to be array, string given
- Search Custom Post Type Custom Fields
- Custom Post Type not appearing in website search
- Custom Fields vs Separate Table
- Keyword search limited to specific post type filtered by multiple custom taxonomies?
- Custom search for custom post meta with pre_get_posts interferes with WP search
- WooCommerce product search titles only
- I did group my search results by post type, but how can i give each of them its own order?
- custom post type Search returns No Results in admin panel
- Search Custom Post Type & Taxonomies
- How to stick custom post at the top in search results
- filter custom post type by meta key in dashboard
- Can I search only some of the fields of a custom post type?
- WordPress sort search results by custom order
- Pretty URL for custom search for custom post type
- Add post location with mile radius allowing search
- Include custom post type content in search
- Get post count for search result based on post type
- Search by tag name and category
- Advanced search form with filters for custom taxonomies
- filter search custom field query
- Different results between permalink and query var search
- WordPress Custom Search by post_type
- Include custom taxonomy term in search
- What content types are shown at a search page?
- Search one custom post type ONLY, disable “all posts”
- Custom Taxonomy Search result page
- search custom post type by custom fields on front end
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- Custom Search | check multiple meta_value for search value
- Hide custom post type from search based on custom taxonomy
- Pagination on search results page
- Best way to create a search for custom post type by custom field values
- Blank search results on custom search
- Multi Parameter search with custom post type category and tag
- Limit search field to just search a custom post type with custom fields
- Redirecting search to specific templates with $_GET[“post_type”]
- Search custom type post
- How to have multiple search result pages in wordpress with taxonomy terms listed
- Creating a custom WP query for a Custom Post Type
- In the php, how can I have a category of a custom post type display?
- Search Function not searching correct custom_post_type even though post_type is defined in search args
- WP_List_Table Inside Metabox Not Working on Clicking Search Button
- Custom Post type doesn’t appear in search results
- search results to show individual ACF fields from inside custom posts
- post_type incorrect for custom post type
- Live search by custom tag
- how to create custom taxonomy drop downs for parents and child
- WP_Query with custom post type search showing all results every time
- Extensive search filtering and results->PDF in the front-end
- Search form to find custom meta box generated data
- Trying to modify custom search function in plugin to search postmeta table for keyword as well as posts table
- 404 error Custom search results page for custom post types with friendly URL
- Custom post type blog pagination conflict
- Multiple search template with separate stylesheets
- Advanced search form with filters for custom taxonomies and custom fields
- Searching for a single custom post type, buddypress
- Customising wordpress search and using $_GET[“s”]
- How do I do this?: If custom post type exists, echo it, else do not
- WordPress search results
- Drop Down Filter with CPT as Options for Search Form
- Searching Custom Posts content with JQuery
- Custom Field Search
- WordPress search results grouped by post type
- How do I provide a search form for a specific post type, that is capable of searching within custom fields of the specified CPT?
- Group search results by post type, but having a unique heading for each section?
- How to exclude html tags and class on search
- Multiple search forms and respective results page templates?
- Get a custom post type’s taxonomy type term names displayed as checkboxes and filter
- Exclude multiple custom post types from search
- How do I create a custom search function to only show contact information if they search for an exact unique identifier?