Renaming Custom Post Types and Taxonomies

SQL query for renaming the posts: UPDATE `wp_posts` SET `post_type` = ‘<new post type name>’ WHERE `post_type` = ‘<old post type name>’; SQL query for renaming taxonomy: UPDATE `wp_term_taxonomy` SET `taxonomy` = ‘<new taxonomy name>’ WHERE `taxonomy` = ‘<old taxonomy name>’; That should take care of all of the database areas. Just remember to match … Read more

The Difference Between Hierarchical and Non-Hierarchical Taxonomies?

The simple answer is that terms in hierarchical taxonomies can have child terms. But what else? ‘hierarchical’=>false When you specify a ‘hierarchical’=>false you get the following type of metabox which is the metabox format WordPress also uses for Post Tags: ‘hierarchical’=>true However when you specify ‘hierarchical’=>true you get the following type of metabox which is … Read more

Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?

I added new field ‘picture’ (input type file) to category with help of these add_action(‘category_edit_form_fields’,’category_edit_form_fields’); add_action(‘category_edit_form’, ‘category_edit_form’); add_action(‘category_add_form_fields’,’category_edit_form_fields’); add_action(‘category_add_form’,’category_edit_form’); function category_edit_form() { ?> <script type=”text/javascript”> jQuery(document).ready(function(){ jQuery(‘#edittag’).attr( “enctype”, “multipart/form-data” ).attr( “encoding”, “multipart/form-data” ); }); </script> <?php } function category_edit_form_fields () { ?> <tr class=”form-field”> <th valign=”top” scope=”row”> <label for=”catpic”><?php _e(‘Picture of the category’, ”); ?></label> … Read more

Get Posts Under Custom Taxonomy

Your tax query is incorrect, field should be the field you want to query on: term_id, name, or slug – $posts_array = get_posts( array( ‘posts_per_page’ => -1, ‘post_type’ => ‘fabric_building’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘fabric_building_types’, ‘field’ => ‘term_id’, ‘terms’ => $cat->term_id, ) ) ) );

How to show a hierarchical terms list?

Use wp_list_categories with the ‘taxonomy’ => ‘taxonomy’ argument, it’s built for creating hierarchical category lists but will also support using a custom taxonomy.. Codex Example: Display terms in a custom taxonomy If the list comes back looking flat, it’s possible you just need a little CSS to add padding to the lists, so you can … Read more

Is There a Difference Between Taxonomies and Categories?

Taxonomies, as previously described are a collective noun for the following category post_tag post_format link_category custom taxonomy The first four are built-in taxonomies, while custom taxonomies are taxonomies that are manually created by the user with register_taxonomy. Custom Taxonomies can be hierarchical (like the build-in taxonomy category) or not (like post tags) The categories and … Read more