Order terms by creation date

If you want to achieve that, then you need to add creation_date for each taxonomy, hooked with ‘create_category’ (or create_YOURTAXONOMYNAME) function. lets say,for example, you add a new category : add_action( “create_category”, ‘my_func123’, 10, 2 ); function my_func123( $term_id, $tt_id){ update_option(‘my_taxnm_date_’.$term_id, time()); } then later, anytime, you will be able to get the creation date … Read more

Change the last separator in the_terms

$terms = get_the_term_list( $post->ID, ‘post_tag’, ‘Tags: ‘, ‘, ‘, ”); echo preg_replace(‘/^(.+),([^,]+)$/’, ‘$1 &$2’, $terms); Explanation for /^(.+),([^,]+)$/: / – delimiter ^ – string beginning .+ – 1 or more characters [^,]+ – 1 or more characters that are not a comma $ – string end $n is the nth match i.e. nth pair of … Read more

wp_set_post_terms struggle :(

Just by posting.. I made a final test. And I suspected a conflict somewhere in the custom taxonomy names, what I did is I changed the name of the custom taxonomy in function.php wp_set_post_terms( $post_id, $county, ‘kommun1’); is working well 🙂 I got so focused on the variable. my bad… have a nice day

How to show term child only if has a post

AS per my knowledge you need to write following function in your functions.php and check whether the term has post using the below function function check_term_posts($tax_slug, $term_id) { $args = array( ‘post_type’ => ‘post’, ‘status’ => ‘publish’, ‘tax_query’ => array( array( ‘taxonomy’ => spanishcategory, ‘field’ => ‘term_id’, ‘terms’ => 169 ) ) ); $term_query = … Read more

Confused by get_the_terms to use in a new wp_query

$terms is an array of terms, so PHP doesn’t know what you mean when you say $terms->slug. With foreach, you’re iterating through this array. If you only care about the first element, you can simply use $slug = $terms[0]->slug;. This will get you in trouble when there are no terms, though, so you will want … Read more

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