How to hide some categories in category list under post in wordpress?

I’m afraid that in this case you will have to go throught the categories and have some logic here. you can use a function like this one: function filterCategories($postId,$excluded, $separator){ $categoriesToDisplay = ”; $count = 0; $allCategories = get_the_category($postId); foreach($allCategories as $category) { if ( !in_array($category->cat_ID, $excluded) ) { // get that category link $cat_link … Read more

Display category-specific comments in sidebar

Try this function: function get_category_comments($category_id, $limit = 5) { global $wpdb; $sql = ” SELECT {$wpdb->comments}.comment_ID FROM {$wpdb->comments}, {$wpdb->posts}, {$wpdb->term_taxonomy}, {$wpdb->term_relationships} WHERE 1=1 AND {$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID AND {$wpdb->term_relationships}.object_id = {$wpdb->posts}.ID AND {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id AND {$wpdb->comments}.comment_approved = ‘1’ AND {$wpdb->term_taxonomy}.term_id = ‘{$category_id}’ ORDER BY {$wpdb->comments}.comment_date DESC LIMIT 0, {$limit} “; $comments = array(); foreach … Read more

I Cannot Create New Category

Tom’s answer looks really useful to me. I’d also suggest the standard WP troubleshooting tip of turning off plugins and seeing if you are able to add categories when your plugins are off. If so, turn plugins back on one by one and see if you can figure out which plugin is the “culprit”. Sometimes … Read more

Giving wp_list_categories the class of the category

I would use get_categories() instead, so that you can have better control over the output of your list. And if I recall correctly, wp_list_categories calls get_categories anyway. You can use the same $args array in either function, and you should get the same categories as a result. Then you can simply build your own unordered … Read more

Get Tags specific to Category using WooCommerce plugin

Finally solve the problem: t1.taxonomy = ‘product_cat’ AND p1.post_status=”publish” AND terms1.term_id IN (“.$args[‘categories’].”) AND t2.taxonomy = ‘product_tag’ AND p2.post_status=”publish” In the functions.php t1.taxonomy = ‘category’ AND p1.post_status=”publish” AND terms1.term_id IN (“.$args[‘categories’].”) AND t2.taxonomy = ‘post_tag’ AND p2.post_status=”publish” rename category to product_cat, and post_tag with product_tag.