Add custom taxonomy fields when creating a new taxonomy

Solved! add_action( ‘create_category’, ‘save_extra_taxonomy_fields’, 10, 2 ); Props to the Category Meta plugin. I downloaded various category meta plugins from the WP repo, and this one has the ability to add the meta data on the Add New screen. I dug through the code and found the elusive create_{term} hook.

Order get_terms using a Custom Field

Rather than outputting your terms in that initial loop, I would use it instead to build a new array, with your issue_date as the key: $my_new_array = array( ); foreach ( $terms as $term ) { $issue_date = get_field( ‘issue_date’, $term ); $my_new_array[$issue_date] = $term->name; } You can then loop through this new array in … Read more

custom post type taxonomy “tag” archive : no post found

Tag and Category archive queries default to querying only the post post type, to add your custom post type to those queries, you can use the pre_get_posts action: function wpa_cpt_tags( $query ) { if ( $query->is_tag() && $query->is_main_query() ) { $query->set( ‘post_type’, array( ‘post’, ‘object’ ) ); } } add_action( ‘pre_get_posts’, ‘wpa_cpt_tags’ );

How do I add a custom taxonomy as an option for menus under “Appearance” > “Menus”

Your custom taxonomy should show up as an option for custom menus, if you have ‘show_in_nav_menus’ => true as a parameter when you register your post type with register_post_type(). You can check all the available parameters in the codex entry http://codex.wordpress.org/Function_Reference/register_post_type#Arguments

Loop through custom taxonomies and display posts

I thought I would provide another answer as the above one is a little hacky, also I added another layer that gets all taxonomies for a post_type. $post_type=”post”; // Get all the taxonomies for this post type $taxonomies = get_object_taxonomies( (object) array( ‘post_type’ => $post_type ) ); foreach( $taxonomies as $taxonomy ) : // Gets … Read more

Custom columns on edit-tags.php main page

You can do this by hooking into the ‘taxonomy’_edit_form and edited_’taxonomy’ actions. add_action(‘taxonomy_edit_form’, ‘foo_render_extra_fields’); function foo_render_extra_fields(){ $term_id = $_GET[‘tag_ID’]; $term = get_term_by(‘id’, $term_id, ‘taxonomy’); $meta = get_option(“taxonomy_{$term_id}”); //Insert HTML and form elements here } add_action(‘edited_taxonomy’, ‘bar_save_extra_fields’, 10, 2); function bar_save_extra_fields($term_id){ $form_field_1 = $_REQUEST[‘field-name-1’]; $form_field_2 = $_REQUEST[‘field-name-2’]; $meta[‘key_value_1’] = $form_field_1; $meta[‘key_value_2’] = $form_field_2; update_option(“taxonomy_{$term_id}”, $meta); } … Read more

Query Custom Post by Taxonomy Category

There are 3 ways of doing that: a) … ‘category_name’ => ‘category-1’ … b) … ‘taxonomy’ => ‘category’, ‘term’ => ‘category-1’, … c) … ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘category-1’ ) ) ) … More info: http://codex.wordpress.org/Function_Reference/WP_Query