Finally figured out the solution. Answering it if anyone finds it useful. Where $_GET['s_qr']
has a search query from a user from another page.
$i = 0;
$parent_name="";
$taxonomyName = "product-cat";
$search_r = array();
$parent_terms = get_terms( $taxonomyName, array( 'parent' => 0, 'orderby' => 'slug', 'hide_empty' => false ) );
foreach ( $parent_terms as $pterm ) {
$parent_name_1 = $pterm->name;
$terms = get_terms( $taxonomyName, array( 'parent' => $pterm->term_id, 'orderby' => 'slug', 'hide_empty' => false ) );
foreach ( $terms as $term ) {
//Find if the the category name has the search query
if (stripos($term->name, $_GET['s_qr']) !== false) {
$search_r['item'][$i] = $term->name. " in ".$parent_name_1;
$i++;
}
}
}
print_r($search_r);
Related Posts:
- The Operator “NOT IN” Does Not Work In tax_query
- Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)
- How to have this permalink structure: post_type/postname/custom_inner_page
- How to display Related Posts based on number of taxonomy terms matched
- tax_query not working in template
- WP_query – Filter by tax_query and meta_query using multiple select
- WP_Query parameter conflict
- how to get this tax_query working?
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- tax_query (if the terms are empty)
- custom post type and a “sticky” position taxonomy
- WP Query tax_query not returning posts
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- tax_query showing no results
- WP Query Conditionally query meta and taxonomy
- Custom Post Type Loop within Shortcode
- Fetch taxonomies by custom post type id array
- Group custom posts by custom taxonomy names
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- How can i skip same post from taxonomy term?
- Filter by custom taxonomy slug on a custom post type
- Displaying a custom post types custom taxonomy value?
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- $wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies
- Query Multiple Taxominies Across Multiple Post type’s
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Query custom post type by category slug
- Display CPT posts based on specific taxonomy
- shortcode to show custom post types by category
- Query/list all terms and their custom post count
- Filtering WP_Query Dynamically on the Front-End
- What template files do I need to customise custom-category-term-links rather than fall back on archive.php?
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Genesis filterable portfolio isotope [closed]
- wp_query check if integer exists in custom field’s array
- Wrong request query on cpt and tax
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Search / Filter posts on Title/Content OR Tags
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Custom-Posttype & Custom Taxonomy WP_Query
- Custom loop with multiple taxonomy queries
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Tax query not producing any results
- Help need making decision. Ads rotating site on wordpress
- custom taxonamy and post type
- Return the latest post from a custom Taxonomy and Post Type
- Don’t know how to show custom taxonomies from a custom post_type
- How to Filter custom post type by taxonomy?
- Custom taxonomy rewrite give pagination 404
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Custom post taxonomies as tax_query terms?
- Custom WP Query on custom meta and sort by multiple meta keys value
- Display a grid of taxonomy terms at root taxonomy page
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How can I made custom taxonomies relationship?
- What’s the WP way to load remaining custom posts?
- Why is this query not working? (Standard posts + custom post type)
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- Custom taxonomies relationship
- Custom Widget WP_Query problem
- How do I display the grand child items of a taxonomy term?
- Query Custom Post Type Taxonomy term with multiple parameters
- First custom field value (out of several) displayed twice after query
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- WP_Query orderby and tax_query
- How to produce a sub-page-system in WordPress
- Advanced search form with filters for custom taxonomies
- Why is my WP_Query outputting my entries twice?
- Retrieve custom post types by custom taxonomies with WP_Query
- WP the_posts() on single-cars.php get category link
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()
- How to make WP_Query not to show irrelevant posts?
- WordPress wp_query() basic question about args
- Create an archive page for custom post type with custom taxonomy
- Custom WP_Query doesn’t display all posts
- Using page slug in wp_query
- WP_Query() with custom post type and taxonomy — get all terms?
- Custom taxonomy wp_query woes.
- Variable not working in WP_Query
- Creating two loops based on different logic
- Wp Query with multiple custom tag(taxonomy) by get the terms
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- WP_Query with custom post type ID
- Different options per post type in WP_Query
- Show Taxonomies with admin area for custom post type?
- Include custom post type custom taxonomies in Categories widget
- How to sort a WP_Query by a custom field AND ALSO filter by a different custom field
- How to show all taxonomies within custom post type loop
- How to get the post terms from a child taxonomy
- display posts of custom post type with custom taxonomy
- Custom post type and custom taxonomy 404 on page 2
- How to count other posts not having specific taxonomy terms?
- Exclude latest post from WP_Query taxonomy term loop
- How to query Posts from a custom post type which contains a custom taxonomy?
- Query Posts that have Custom Taxonomy
- List all Custom Post Type posts excluding certain Taxnomy term
- Running a custom query inside another cpt single and trying to grab a variable
- Searching post types