solved it with this code
function prefix_url_rewrite_templates() {
if ( get_query_var( 's' ) ) {
add_filter( 'template_include', function() {
return get_template_directory() . '/search.php';
});
}
}
add_action( 'template_redirect', 'prefix_url_rewrite_templates' );
if there is a better way please notify me 🙂
Related Posts:
- tax_query shows no results if nothing is selected
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- Extend product search with meta in WooCommerce
- Can’t fetch Custom Post Type Data through Custom Query
- Redirect Search to Form When No Product Results Are Found
- Hide products in uncategorized category from search results
- How to restrict search on a certain page to only return results against custom taxonomies?
- $wp_query->found_posts not returning correct value
- WordPress WP_Query Array Custom search via taxonomies
- Filtering product search results using tags
- Custom Taxonomy in custom REST API search
- Can I force WP_Query to return no results?
- Get WooCommerce best selling products for the current month [closed]
- Exclude a term of a taxonomy with a custom post type in a search
- Woocommerce query by price range and custom meta key
- Custom search form with empty parameters
- Find all product that contain terms with %keywords% in WP_Query
- WP Query – Get WooCommerce Products with variation that is in stock
- Multiple search queries on one page
- Search product by brand name in wp_query
- How to Modify Taxonomy Archive Page with Search Parameter?
- Get array of current post term ID’s
- Including only current user’s posts in search
- WP_Query, tax_query and term_meta: How to?
- Custom category search box for WordPress
- Refine search results using WP_Query
- Search Posts with Custom Fields as query
- Extending woocommerce admin product search
- Assigning a meta_query value based on regexp to wp_query fails
- Getting Taxonomy inside WP_Query Loop
- WC displaying products from category
- Order posts by taxonomy count
- Search for multiple tags?
- Sort by price woocommerce by ID post_meta
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 – 343)
- Display filtered results into custom page
- WooCommerce – get product sub categories
- WP_Query ignoring tax_query when is_singular
- Cutom wp_query for geolocation search, pagination not working
- How do I exclude the lowest level terms in a taxonomy?
- Woocommerce – Changing the order of the upsell products [closed]
- Query with search and subscribers only output
- how can I override The Events Calendar query modifications?
- Post loop for all taxonomy terms
- How do I get my custom query to work with search results after the first page?
- Modify Search Query if original Query gave no results
- Need Sub-category with main Category
- Include post content of linked posts in search
- Prevent author bio page from showing in search results
- How do I amend wp_query before it is run/executed?
- WordPress Custom Search Form Displaying Unexpected Results
- Tax Query only returns for the first of several terms
- how to get this tax_query working?
- How to properly use AND / OR in custom search
- How do I get Woocommerce product variation name and variation description in a WP_Query?
- Slow Query On Search
- How To Keep Search Title the same on paged Results
- Check if a post has term inside loop
- How to get posts by category and by choosing a taxonomy term?
- Query Taxonomy By Page Title
- Filter out a meta key in the Search results page with two CPT
- Query by key or author
- Ignore image urls in wp_query search
- Can I make a search query which includes a space?
- get_the_terms has strange result since version 6.0
- How to display posts from custom post type category(custom Taxonomy) wise?
- My combination of ‘post_type’ and ‘tax_query’ not working?
- Filter for each loop when WP_Query has no posts to show
- Custom Woocommerce Product Query
- WP_Query no result if keyword contains number
- WooCommerce WP_Query using tax_query returns no results (0 = 1)
- How sort products by calculate value? ( custom post meta, price, option)
- wc_get_products() return empty object
- How do I stop the same post showing multiple times in a archive?
- WooCommerce. How To Exclude Subcategory Products From Category Listing Page
- get_posts return only first result
- Related categories order posts by category
- WordPress – Form does not filter the results of taxonomies
- How to get taxonomy image attached to a Post Type WordPress
- Show one post of each custom taxonomy
- update_post_meta performance in a loop woocommerce
- update_post_meta performance in a loop woocommerce
- getting posts by tags
- Query child posts with tax query on parents
- Custom Post Type WP_Query with filters and search
- WordPress search page pagination displaying but not functional
- Search has query that will return no results
- WP Query – Search in title or author_name
- Get posts by similar names and categories
- How to define a custom hierarchy for terms?
- How do i query woocommerce booking post type on init action?
- Adding additional taxonomies to wordpress taxonomy page
- Woocommerce orderby rand with tax_query not random
- Query Top Set Custom Taxonomy In Given Timeperiod
- $wp_query when new WP_Query
- query_posts problem – need help
- Show linked products using wp query and woocommerce
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise