How to enable hierarchical permalinks for hierarchical taxonomies

This is implemented in WordPress now as of 3.1. When you register your taxonomy, make sure to set rewrite hierarchical to true as well as the taxonomy itself: <?php register_taxonomy(‘genre’,array(‘book’), array( ‘hierarchical’ => true, // this makes it hierarchical in the UI ‘labels’ => $labels, ‘show_ui’ => true, ‘query_var’ => true, ‘rewrite’ => array( ‘hierarchical’ … Read more

Get total number of comments from posts in a specific custom taxonomy

You’ll need to loop through your posts, use get_comments_number() to get the number of comments for each post, and then accumulate the total number of comments in a separate variable. e.g.: <?php $features_comment_count = 0; if ( have_posts() ) : while ( have_posts() ) : the_post(); $features_comment_count += get_comments_number(); endwhile; endif; ?> (I’ll assume that … Read more

Taxonomy slug by term ID

For a menu object $item: $item->object stores the object the menu item refers to, e.g. ‘post’, ‘page’, ‘my-cpt’, or ‘my-taxonomy’ (the post type name, or the taxonomy name) $item->type stores what ‘type’ of object is it, either: ‘post_type’ or ‘taxonomy’. For custom links, these are both custom

A better Media LIbrary Experience

Yes, the media library is long overdue an overhaul, and it seems there are some guys working on it right now. With any luck some changes will make it in to the next release. Take a look here at some of the slides and the many commments and feedback: http://make.wordpress.org/ui/2012/07/30/media-wireframes/

wp_insert_term is adding a term that has no name

As noted in the OP’s comments, some non-ASCII characters may not be supported in term names under certain conditions. To replace all suspect characters with an underscore, use the following code: $categoryname = preg_replace(‘/[^a-z0-9]/i’, ‘_’, strtolower($categoryname)); wp_insert_term($categoryname, “department”); To replace all suspect characters with a dash, use the following code: $categoryname = preg_replace(‘/[^a-z0-9]/i’, ‘-‘, strtolower($categoryname)); … Read more

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