Order posts by (hierarchical custom) taxonomy terms and term children

This query will handle two levels of hierarchy in your taxonomy. More than two levels of hierarchy and you’ll need a recursive self-join. What this does is return the posts in the correct child within parent order. To create the appropriate parent level headings, you’ll have compare the current post’s parent taxon with that of … Read more

Removing Edit Permalink/View “Custom Post Type” areas

There is a filter get_sample_permalink_html that returns this area as a string. Here’s how you can use it: <?php add_filter(‘get_sample_permalink_html’, ‘perm’, ”,4); function perm($return, $id, $new_title, $new_slug){ global $post; if($post->post_type == ‘testimonials’) { $ret2 = preg_replace(‘/<span id=”edit-slug-buttons”>.*<\/span>|<span id=\’view-post-btn\’>.*<\/span>/i’, ”, $return); } return $ret2; } ?> Updated the code. Please check this. Updated Changed the double … Read more

Add comments meta fields to comments metabox on post edit screen

Unfortunately the hooks: manage_{$this->screen->id}_columns manage_{$this->screen->id}_sortable_columns manage_comments_custom_column are not available for the post-comments list table, constructed within the wp_ajax_get-comments call. That table consists only of two columns: author and comment. The data for author, avatar, email, url and IP is displayed in the first column. We can on the other hand use a hack like: add_filter( … Read more

Categories under custom post types doesn’t show properly

Categories and Taxonomies are not exactly the same. A category is a default taxonomy You can use categories with custom post types however its better to use custom taxonomies because the truth is, they are an extremely powerful way to group various items in all sorts of ways. add_action( ‘init’, ‘wpsites_custom_taxonomy_types’ ); function wpsites_custom_taxonomy_types() { … Read more