You can simply include a custom search function into your search by using pre_get_posts
You can do something like this
function search_filter($query) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_search) {
$query->set('post_type', 'your-custom-post-type' );
}
}
}
add_action('pre_get_posts','search_filter');
Related Posts:
- Searching multiple custom post types and pages
- previous_post_link() and next_post_link() with a custom post type?
- Setting a custom sub-path for blog without using pages?
- Include different loop templates in search query
- Trying to edit the single page from a Custom Post
- Add post location with mile radius allowing search
- Custom post_type search pages
- Custom Empty Results page for my Custom Post Type
- Creating separate feeds for custom post types
- Template code to split a post and print a custom field?
- Building a Data Intensive Website with WordPress
- Is it possible to get the specific content on the search page?
- Post template with breadcrumb needs to show page navigated from
- Create a post automatically if search result has zero results
- Post template not applying on theme (potentially rendering as Page template)
- Assign for all post of a post type a specific single-post template
- Custom post type with two templates
- Why isn’t my custom post type using the corresponding custom post template?
- How to make a template for a specific post of a custom post type?
- Apply text based styling done for a single post in WPBakery to all posts / create a template out of it [closed]
- Using The REST API How To Pull All Custom Posts?
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- I did group my search results by post type, but how can i give each of them its own order?
- Set up Custom-Post-Type Author Archive
- Show the same Article Available in Other Categories
- Getting posts under the custom post type ui category
- How to clone the “Projects” Custom Post type in Divi theme
- Storing posts from query and accessing later via AJAX call
- If post has custom field then display css-class
- custom post type Search returns No Results in admin panel
- Display only one post each WEEK
- List children on child post
- Search Custom Post Type & Taxonomies
- Restrict custom post type from appearing with ?post_types=
- Show custom post type filtered by category
- create parent post using wp_insert_post
- Turn on and off custom post type from admin?
- Missing Posts in Custom Taxonomy List
- Multiple meta_values in the pre_get_posts filter?
- Display random posts, but omit the post it is on?
- Query with no terms uses index.php template instead of archive.php
- How to order separated Custom Post Search results
- How do I do this with WordPress? Taxonomies?
- Disable block with taxonomies at post page
- I would like to have different styles for my posts based on the content of each post
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- search also in taxonomy, tags and custom fields
- Create template for taxonomy results limited by Custom Post Type
- Showing posts from different categories and from custom post type
- Custom post type search using $_SESSION and pre_get_posts
- Get latest 3 posts from multiple CPT in one query
- Template for custom post with custom taxonomy
- How to stick custom post at the top in search results
- WordPress Custom Post Type Children Template
- filter custom post type by meta key in dashboard
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Which post does a taxonomy term belongs to?
- Can I search only some of the fields of a custom post type?
- Custom Post Type And “fopen”
- Getting template_include to work when allow_url_include is off?
- List custom taxonomy specific to one custom post type
- Filter custom posts using auto populated dropdown selectors
- Post image in WordPress not appearing on home page
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Custom post type content using custom fields without template
- Meta query for custom post type ignored in main query
- Changing custom type name hides the posts
- Display Ad on Specific Categories
- Make parts of your wordpress website completely built with data from external APIs?
- Hiding posts by other users and non-logged in
- 2 Templates 1 custom post type according url
- WordPress sort search results by custom order
- Update Post Meta for a logged in user
- Add custom field to Posts and sort by it
- Add custom post type settings to wordress default posts
- Get related posts of child term of custom post type
- Two Custom Post Types Many to Many Relationship
- Problem with displaying posts in the CPT category
- Custom taxonomy and custom post type – wrong permalinks and template
- JS innerhtml changing style when using AJAX
- Show titles, date of all posts on single category page
- Can I override a CPT template on a per post basis with Gutenberg block editor?
- Including metaboxes from custom post types in global search — continued
- Custom post type not showing in search result
- Side effects of Script and Iframe in post
- How to change the post type a theme shows by default?
- Set a checkmark in a category based on a URL-parameter
- Several post types on WP Query by tag and taxonomy
- No Permission to add new Page, Post or CPT with Admin role
- Update postmeta Parent when post_status child change
- What to and how to proceed with CPT to make DB small and efficient?
- Content vs Template on custom post
- custom post type category count shortcode
- Portfolio Page for Classic Posts
- Pretty URL for custom search for custom post type
- Include custom post type content in search
- Get the category from custom post type
- Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?
- Set up post page like JAMA articles
- How to use custom template files in deeper directory?