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
- WordPress pagination not working on template search.php
- Cutom wp_query for geolocation search, pagination not working
- wordpress search word, âhello worldâ ===> âhello+worldâ ===> âhelloâ, âworldâ
- How do I exclude the lowest level terms in a taxonomy?
- wp_query for multiple cities (multiple values in a metabox)
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- Woocommerce – Changing the order of the upsell products [closed]
- Out Of memory issue on post per page parameter
- query_vars overriding WP_Query args
- Query with search and subscribers only output
- how can I override The Events Calendar query modifications?
- Search by post id in a specific page then auto-redirect to searched post
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Search for “2nd” also returns “22nd” in wp_query
- Query with relation and one without relation using multiple taxonomies?
- How to display an other custom post type in a different custom post type’s archive?
- Search form not working with custom query?
- Post loop for all taxonomy terms
- Display custom tags on pages that have a specific page parent
- How to make search for posts using get method?
- wp_query args adding muitiple tax_querys
- Categorising search results based on Custom Fields
- Hiding taxonomies with no children WP_Query & tax_query
- Advanced search form with filters for custom taxonomies
- WooCommerce search products between price range using WP_Query
- Add filter post_where and passing post_type argument
- find posts that don’t have a custom taxonomy
- using pre_get_posts for search results not found
- Custom taxonomy.php not working
- wp_query not working with post_type
- Search posts missing a particular custom field
- 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
- Woocommerce – exclude only older out-of-stock items
- Filter Custom Taxonomy Posts
- Need Sub-category with main Category
- Woocommerce pagination and result count after custom loop
- WP_Query args to show posts from specific custom taxonomy
- WP_Query for a taxonomy with different taxonomy types
- How to query woocommerce product by pricing? [closed]
- Include post content of linked posts in search
- Replacing search results with custom external query
- Prevent author bio page from showing in search results
- get all posts associated with a custom taxonomy
- How do I amend wp_query before it is run/executed?
- wp_query search not taking keywords with together for multiple words
- How to set an alternate posts_per_page value for default queries in different templates
- How to order WP_Query to group results?
- Using custom taxonomies in a query
- Wildcard search in WP Query
- Get a list of posts by specific category
- WordPress Custom Search Form Displaying Unexpected Results
- Search Page Returns Nothing
- How to add custom meta to ‘pre_get_terms’?
- Tax Query only returns for the first of several terms
- how to get this tax_query working?
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- How to properly use AND / OR in custom search
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- How do I get Woocommerce product variation name and variation description in a WP_Query?
- WP_Query Taxonomy categories filtering
- Exclude a Woocommerce product from WP_Query
- How to avoid bypass of search bar rules?
- Woo Commerce using WP_Query to get products that match price range, with an additional required product attribute
- Issues with search after added meta_query
- One WP_Query that always shows 1 post from category X and 1 post from “not in category X”?
- How to print term name inside wp post loop
- How do you determine if a result in a search query is a post or a page?
- Slow Query On Search
- Multiple meta_key ordering with pre_get_posts
- Sorting search results with custom dropdown
- How to echo woocommerce category name
- How To Keep Search Title the same on paged Results
- Assign a minimum result count for WooCommerce query shortcodes?
- wp_query show all values
- change posts_orderby of the callback wp_query?
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- Woocommerce: order posts by meta key
- Check if a post has term inside loop
- var_dump of WP_Query object is not empty, while .have_posts() return false
- WP_Query for products always returns empty
- 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
- Custom Taxonomy Breaks Pages
- Query by key or author
- Unlimited Page Sitemap Link
- Ignore image urls in wp_query search