Dynamically tax_query terms

If $taxonomy_category is already an array, then: ‘terms’ => array($taxonomy_category) should just be: ‘terms’ => $taxonomy_category where $taxonomy_category is equal to whatever was submitted from your form as $_POST[‘taxonomy_category’] or $_GET[‘taxonomy_category’]

Is there a filter hook that I can use to change how taxonomy term names are displayed?

The dynamic filter “term_{$field}” is probably what you’re looking for, where the field is “name.” One approach is to have an array of names and their pseudonyms, then do a check-and-return on them so they’ll display the replacement. add_filter( ‘term_name’, function( $value ) { $terms = [ ‘old’ => ‘new’, ]; // basic example check, … Read more

get_terms won’t display product_cat or any other custom taxonomies when specified

You are maybe running an old version of WordPress (before 4.5). Before WordPress 4.5.0, the first parameter of get_terms() was a taxonomy or list of taxonomies and since 4.5.0, taxonomies should be passed via the ‘taxonomy’ argument in the $args array (that what you are doing, it should work like that). You will find all … Read more

functions to create term and child terms

To create a taxonomy, you should use register_taxonomy(). This function accepts three arguments: <?php register_taxonomy( $taxonomy, $object_type, $args ); ?> The documents on the codex are plenty self explanatory. Now, to insert a term into a taxonomy, you can use wp_insert_term(). Again this function accepts 3 arguments: <?php wp_insert_term( $term, $taxonomy, $args = array() ); … Read more