Tax query with multiple terms in pre_get_posts

Just use: ‘terms’ => $rt_cat_id I’ll work for both array and single-based values. Or you can simplify your code as follows: if( isset( $_GET[ ‘listing_cat’ ] ) ) { $tax_query[] = array( ‘taxonomy’ => ‘listing_category’, ‘field’ => ‘id’, ‘terms’ => $_GET[ ‘listing_cat’ ] ); }

How to get the $meta_type given the $object_id

Given the $object_id (and a WP_Term object), how does one go about determining the $meta_type to be passed to update_metadata()? Unfortunately, that is not possible because each object has its own table and therefore the same ID (1, 2, 3, etc.) could refer to a post, comment, term, etc. So that’s why we have different … Read more

Ordering taxonomy output in this function

get_ancestors() returns an array with the parent first, then the grandparent, etc. What you need to do change get_ancestors() to array_reverse( get_ancestors() ), so that you have the level of the parents descends, instead of ascending.

How do I print a term list but alter the link text?

<?php $terms = get_terms( $taxonomies, $args ); $term_name_array = array(); foreach($terms as $term){ $term_name_explode = explode(“-“,$term->term_name); $myterm_name=””; for($i=0;$i<count($term_name_explode)-2;$i++){ $myterm_name.=” “.$term_name_explode[$i]; } $myterm_name = ltrim($myterm_name); if(in_array($myterm_name,$term_name_array)) continue; $term_name_array[] = $myterm_name; ?> <li><a href=”https://wordpress.stackexchange.com/questions/48983/<?php echo get_term_link($term->term_id)?>”><?php echo $myterm_name;?></a></li> <? } ?>

Get current term in single.php

You can use wp_get_object_terms($object_ids, $taxonomies, $args) to get all terms from a defined set of taxonomies for an object The $taxonomies parameter can be an array of taxonomy names. http://codex.wordpress.org/Function_Reference/wp_get_object_terms

array_replace throwing php_warning but working anyway

$term_object->order tells you $term_object is an object. array_replace() expects an array, not an object. Not sure why it works, maybe PHP is casting the object to an array. array_replace( $term_objects, (array) $term_object ); … could fix the warning.

WordPress Term for Custom List

In wordpress they are called Custom Post Types. You can create them for instance in the functions.php. There are many examples in the web how to do that.

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