How to create page that lists tags by initial letter?

First Question’s Answer: For filtering based on your terms first letter you need to filter the query, which you can do with the terms_clauses hook. By putting the below code block in your theme’s functions.php you can do that- function the_dramatist_filter_term_clauses( $clauses ) { remove_filter(‘term_clauses’,’the_dramatist_filter_term_clauses’); $pattern = ‘|(name LIKE )\’%(.+%)\’|’; $clauses[‘where’] = preg_replace($pattern,’$1 \’$2\”,$clauses[‘where’]); return … Read more

wp_insert_post and custom taxonomy

Well I found the answer. The code is correct. Wordpress do in taxonomy.php Line 3392 $count += (int) $wpdb->get_var( $wpdb->prepare( “SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status=”publish” AND post_type IN (‘” . implode(“‘, ‘”, $object_types ) . “‘) AND term_taxonomy_id = %d”, $term ) ); $count is empty because post_status=”publish” in … Read more

Most efficient way to display current post subcategories?

After looking at get_the_terms() again I think I found a better solution: functions.php global $reviews_cat_id_brand; $reviews_cat_id_brand = 158; // using # in case string changes if( !function_exists(‘reviews_print_subcat_link’) ){ function reviews_print_subcat_link($cat_id){ $items = get_the_terms(get_the_ID(), ‘review-category’); $subcat_array = []; foreach ($items as $item) { if($item->parent === $cat_id) { $subcat_array[] = ‘<a href=”‘.get_term_link($item).'”>’.$item->name.'</a>’; } } return $subcat_array; } … Read more