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

Add subcategories posts to the counts column at the admin’s categories list

You can change an array of get_terms() arguments with two filters: get_terms_defaults filters the terms query default arguments; get_terms_args filters the terms query passed arguments. For example, this code will change the default value for the pad_counts parameter for all queries related to categories and called from the administrative part of the site. add_filter( ‘get_terms_defaults’, … Read more