You can add a custom tax_query to your filter, and pass the search query to it:
function searchfilter($query) {
if ($query->is_search && !is_admin() ) {
$s = $query->get( 's' );
$query->set('post_type', [ 'lesson', 'series' ] );
$query->set(
'tax_query',
[
[
'taxonomy' => 'your-taxonomy',
'field' => 'name',
'terms' => $s ,
]
]
);
}
return $query;
}
add_action('pre_get_posts','searchfilter');
Related Posts:
- Amend taxonomy to search in wordpress admin
- Using pre_get_posts to rewrite search query to display posts from multiple taxonomies
- Help With issue on pre_get_posts filter in taxonomy
- How to add custom taxonomy to search
- How to filter WordPress search, excluding post in some custom taxonomies?
- Custom Taxonomy Not Working When added to WordPress Search
- Removing “s” from search with custom parameters
- Advanced search redirecting to another page then filter further
- Filter with two id of the same value CPT UI(taxanomies)
- Include get_term_link inside search
- How to exclude woocommerece product category in search results?
- Include attachments with a custom taxonomy in search
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Custom search filter causes menu and query_posts problems
- Exclude Specific Term from Search
- WordPress database error: [Not unique table/alias: ‘wp_postmeta’]
- How to add taxonomy filter on the query fly?
- pre_get_posts with tax_query causes empty result
- WordPress Search – display taxonomy terms in results
- How to remove “Taxonomy name:” from wp_title
- How to find taxonomy name using only taxonomy TERM ID (or taxonomy term name)
- pre_get_posts OR relation between taxonomy and author
- Sort posts by number of matched terms
- How can I display parent and child taxonomies in separate drop downs?
- Search pre_get_posts filter which can handle multiple post types and categories?
- tax_query not working on main query
- Taxonomies not appearing in columns on dashboard
- Filtering more than one term in a taxonomy in WP
- How to display term description in empty terms archive?
- Save Filter for Taxonomies
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Taxonomy.php issue with search and filters
- Extending wordpress search to include excerpts and taxonomies?
- how to search in custom fields & custom taxonomy for custom search
- How do I sort posts by custom taxonomy?
- Current category link filter
- How Can I Change a Taxonomy URL Based On The Originating URL?
- Creating a custom search form
- How to implement custom search with input fields?
- orderby meta_value breaks taxonomy term archives
- How do I keep the page I’m on within the URL when running a search on a taxonomy?
- Add multiple taxonomy filters to edit.php that support search
- WordPress sort search results by custom order
- Extend & Search Native WordPress Image Galleries With Tags and Taxonomies?
- Simple Filter between multiple taxonomys
- Get parent and children taxonomy in different dropbox
- WordPress Tag or Custom Taxonomy Return All Posts if has that Word in Post Title
- Search Tool only refreshes Page without showing results
- WordPress thinks my custom taxonomy pages are search pages #seo
- Passing form inputs into multi-taxonomy query
- Custom URLs in Custom Search Results
- Search Query for Multiple Terms In Same Taxonomy
- Remove custom taxonomy column from my custom post type columns
- Use an HTML Element To Filter Taxonomies In WP Search
- Query posts using custom taxonomy and selected terms
- Why isn’t the ‘no results’ being shown when a query returns no results?
- Build filter for post-type + multi taxonomies + multi terms
- Clean Custom URL for Serach + Custom Taxonomy
- Search only custom taxonomies
- WordPress autocomplete search with taxonomies
- pre_get_posts post_meta event
- Geographic search with taxonomy structure [duplicate]
- Display taxonomy with a maximum number of letters
- search using multiple taxonomies and keyword
- Taxonomy or Custom Field
- Multiple Drop-Down custom taxonomies search
- Drop-down filter doesn’t retrieve custom taxonomies
- Creating a drop-down and filter button for two custom taxonomies assigned to a custom post type
- Product custom taxonomy is not found when space in name
- Main query disturb pre_get_post by category query
- Add terms to a taxonomy archive from within the same taxonomy
- Keeping session instance of random display results over pagination breaks
- Rewrite Search URL Permalink For CPT Custom Taxonomies
- Search custom taxonomy via query-string?
- Random order not working correctly when using default loop + $query->set
- use apply_filters return taxonomies custom post type
- How to filter a page title with custom taxonomies
- How to paginate with an query var appended to permalink?
- Pre_get_post custom taxonomy combined with custom fields?
- WordPress custom taxonomies new/edit post autocomplete
- Post not showing in my custom advanced search
- Sort Taxonomy List by Custom Values
- Custom taxonomy displayed in search results
- How to perform a search inside a specific taxonomy category
- Exclude 2 in 3 terms of A Taxonomy from all Archives
- Can I use $query->set() (in a pre_get_posts() hook) with a custom taxonomy in WP 3?
- Custom Taxonomy, shows empty value (home page of website)
- Advanced WordPress search form based on custom taxonomy and custom meta value
- Custom Search only for my Custom Taxonomy Page – data
- get_the_terms inside save_post gives old terms
- Search and filter with custom field in taxonomy
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)
- Hide empty categories on widget
- Having trouble querying multiple custom taxonomies
- Change filter id into slug
- How to filter the terms of custom taxonomy by author id in admin panel
- Search for portfolio tags & mixing portfoliotags and post tags
- delete term from taxonomy and assign in new one
- How to show post list based on taxonomy term?