For now I’ve just redirected the default search string (www.sitedomain.com/?s=keyword
) to www.sitedomain.com/trade/keyword
, (trade is my custom taxonomy) although I’m pretty sure this isn’t the correct or best way to do it so it’d be great if someone else has a better solution. Here is the code for redirecting the search string:
function redirect_search() {
if ( is_search() && ! empty( $_GET['s'] ) ) {
wp_redirect( home_url( "/trade/" ) . urlencode( get_query_var( 's' ) ) );
exit();
}
} add_action( 'template_redirect', 'redirect_search' );
Related Posts:
- Include custom taxonomy term in search
- Advanced search form with filters for custom taxonomies and custom fields
- How to replicate some of Drupal Views functionality in WordPress?
- 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
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Custom search for custom post type, custom meta and search fields
- Is there An Input Checkbox Option That Works like `wp_dropdown_categories()` To Use In A WP Search Form?
- How to search from specific post type with tags?
- Include different loop templates in search query
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- CPT Search Form with Taxonomy filter & Or
- Keyword search limited to specific post type filtered by multiple custom taxonomies?
- How to create an advanced filter search?
- search also in taxonomy, tags and custom fields
- WordPress sort search results by custom order
- Pretty URL for custom search for custom post type
- Auto Complete Search
- Search by tag name and category
- Advanced search form with filters for custom taxonomies
- dropdowboxes with pre-selected custom fields optios that filters the results according seach needs
- Include custom taxonomy term in search
- how to get this tax_query working?
- Custom Taxonomy Search result page
- Category Search / Custom Post Type search on my website. Custom Post Types that are “page-like”?
- Custom Search | check multiple meta_value for search value
- Hide custom post type from search based on custom taxonomy
- Ideas on how to organize a project [closed]
- Multi Parameter search with custom post type category and tag
- How to Implement Search Functionality?
- How to have multiple search result pages in wordpress with taxonomy terms listed
- WordPress CPT Taxonomy Dashboard Search – How to include taxonomy in search?
- Live search by custom tag
- Custom search for a custom post type in WordPress
- Extensive search filtering and results->PDF in the front-end
- Advanced search form with filters for custom taxonomies and custom fields
- Archive custom template from search
- Custom Field Search
- List the categories under custom taxonomy
- Custom Post Type and Taxonomy URL rewrite
- How to build a complex page structure
- Returning search results by relevance, including Custom Post Types
- Archive page with multiple taxonomies rewrite
- How to get_queried_object on multiple objects?
- Dynamic variable for custom taxonomy in loop?
- custom taxonomy – Template not working
- Count number of posts which exist in 2 taxonomies?
- Want to turn WordPress into a paid subscription directory
- Removing Duplicate Custom Taxonomy Terms from within a Dropdown Select?
- How to output wordpress custom tags separated by comma?
- Custom taxonomy template for multiple custom post types
- Add/Remove current_page_parent class
- Use different taxonomies in different custom post types’ permalinks?
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- Custom Post Type doesn’t show Draft and Trash Options
- A question on creating filters for custom posts using taxonomy
- How can I made custom taxonomies relationship?
- How to start a new post with custom Taxonomies already set?
- Custom Post Type by Taxonomy
- Different rewrite rules for taxonomies and cp in multisite?
- count results in search page based on custom category
- Assign Custom post to Custom Taxonomy
- Trick to get custom post types to show up on a custom taxonomy page?
- How to add custom taxonomy in custom post type permalink?
- What’s the name of the custom post type yearly archive template?
- Combine multiple getEntityRecords calls
- Create an archive page for custom post type with custom taxonomy
- Custom Post Types Archives and Single Pages not showing custom taxonomy data
- How to setup a single post page for my custom post type?
- Link From Single Post To Taxonomy Term Archive Page
- Pull in taxonomy field of custom post type in new query
- Use the custom post type archive for taxonomies?
- Taxonomy template page not working
- Issue with Custom Post Types and Single
- How to count other posts not having specific taxonomy terms?
- Looping through custom taxonomy and display custom post types (Custom Post Type UI)
- How to create subdomain for custom post type and associated custom taxonomies
- set post_type based on custom taxonomy permalink
- How can I tell if I’m on a custom post type archive page?
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- Why are custom taxonomies only appearing on the edit page of one of these types, but not the other?
- Search CPT by tag ids
- Custom post type 404 category page
- How to associate custom taxonomy terms with custom post type?
- WP_Query not using custom taxonomy categories on custom post type
- Taxonomies are not showing in the category dropdown
- get_the_terms child terms for current post/custom post only
- Combine multiple separate lists into one
- Post Custom & Taxonomy 404 error
- Custom Post Type tag taxonomy “Page Not Found”
- Remove custom post type slug but keep related category taxonomy permalink
- Is it possible to add and display custom post types to an array?
- Custom post type and custom taxonomies display
- Timetable of Custom Meta Data using Custom Post Type and Custom Taxonomy
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- Inserting two categories
- How to manage a bookstore
- Show a wordpress custom post condtionally using a category term