Last active
December 21, 2015 09:28
-
-
Save ejdanderson/6285047 to your computer and use it in GitHub Desktop.
Full list of taxonomy arguments and example of registering them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$taxonomies = array( | |
'taxonomy-slug' => array( | |
'labels' => array( | |
'name' => __('Genres', 'textdomain'), | |
'singular_name' => __('Genre', 'taxonomy singular name', 'textdomain'), | |
'menu_name' => __('Genre', 'textdomain'), | |
'all_items' => __('All Genres', 'textdomain'), | |
'edit_item' => __('Edit Genre', 'textdomain'), | |
'view_item' => __('View Genre', 'textdomain'), | |
'update_item' => __('Update Genre', 'textdomain'), | |
'add_new_item' => __('Add New Genre', 'textdomain'), | |
'new_item_name' => __('New Genre Name', 'textdomain'), | |
'parent_item' => __('Parent Genre', 'textdomain'), | |
'parent_item_colon' => __('Parent Genre:', 'textdomain'), | |
'search_items' => __('Search Genres', 'textdomain'), | |
'popular_items' => __('Popular Genres', 'textdomain'), | |
'separate_items_with_commas' => __('Separate genres with commas', 'textdomain'), | |
'add_or_remove_items' => __('Add or remove genres', 'textdomain'), | |
'choose_from_most_used' => __('Choose from the most used genres', 'textdomain'), | |
'not_found' => __('No genres found', 'textdomain'), | |
), | |
'public' => true, | |
'show_ui' => true, // Defaults to public | |
'show_in_nav_menus' => true, // Defaults to public | |
'show_tagcloud' => true, // Defaults to public | |
'show_admin_column' => true, // Defaults to public | |
'hierarchical' => true, | |
'update_count_callback' => '', | |
'query_var' => 'taxonomy-slug', | |
'rewrite' => array( | |
'slug' => 'taxonomy-slug', | |
'with_front' => true, | |
'hierarchical' => true, // show hierarchical urls, | |
'ep_mask' => EP_NONE | |
), | |
'capabilities' => array( | |
'manage_terms' => 'manage_categories', | |
'edit_terms' => 'manage_categories', | |
'delete_terms' => 'manage_categories', | |
'assign_terms' => 'edit_posts', | |
), | |
'sort' => false, // Remember order in which terms are added to the post | |
), | |
); | |
foreach ($taxonomies as $slug => $args) { | |
// null is object types | |
register_taxonomy($slug, null, $args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment