WP_Query tax_query – Show results if child has parent X

If I’m understanding you correctly get_term_children does what you want. $term_id = 2; $tax_name=”locations”; $term_child = get_term_children( $term_id, $tax_name ); Another possibility would be using get_categories, it has an child_of, taxonomy and depth parameter – the documentation on wp_list_categories, which offers pretty much the same functionality, is better.

Running a custom query inside another cpt single and trying to grab a variable

Does this work? global $post; // make sure the post object is available $slug = $post->post_name; // get the slug // insert the slug into your query $args = array( ‘post_type’ => ‘client_prop’, ‘posts_per_page’ => 10, ‘tax_query’ => array( array( ‘taxonomy’ => ‘prop_neighborhood’, ‘field’ => ‘slug’, ‘terms’ => $slug, ) ) );

Function using get_posts() with tax_query not working when called from functions.php

For testing purposes in your functions.php file, try this – add_action(‘init’, ‘my_test_get_all_bands’, 99); function my_test_get_all_bands(){ echo ‘<pre>’; print_r(get_all_bands()); echo ‘<pre>’; } As I was attempting to say in my comment to your question (and as Pieter Goosen explained rather better), if your taxonomies have not yet been registered then the tax_query portion of your get_all_bands() … Read more

tax query shortcode

You just want to make sure you get all your default attributes set in addition to only adding tax queries when you have all the values set. <?php // [loop post_type=”website” taxonomy=”industry” terms=”beauty” posts=”3″][/loop] // [loop post_type=”website” posts=”-1″ ][/loop] function loop_recent_posts_shortcode( $atts ) { $a = shortcode_atts( array ( ‘posts’ => 6, ‘post_type’ => ”, … Read more

Custom tax_query filter not working for Woocommerce product categories

I figured out what the issue was. The page was displaying categories/subcategories and not the items themselves. This meant that woocommerce_product_subcategories() was the one filtering and that uses a different hook. Here is what I added to my functions.php file. add_filter( ‘get_terms’, ‘get_subcategory_terms’, 10, 3 ); function get_subcategory_terms( $terms, $taxonomies, $args ) { $new_terms = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)