Last active
December 14, 2015 03:19
-
-
Save paulund/5019981 to your computer and use it in GitHub Desktop.
A Wordpress snippet to register a new taxonomy.
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 | |
add_action( 'init', 'register_new_taxonomy' ); | |
function register_new_taxonomy() { | |
$labels = array( | |
'name' => _x( 'plural taxonomy', 'Taxonomy general name', 'text_domain' ), | |
'singular_name' => _x( 'single taxonomy', 'Taxonomy singular name', 'text_domain' ), | |
'search_items' => __( 'Search plural taxonomy', 'text_domain' ), | |
'popular_items' => __( 'Popular plural taxonomy', 'text_domain' ), | |
'all_items' => __( 'All plural taxonomy', 'text_domain' ), | |
'parent_item' => __( 'Parent single taxonomy', 'text_domain' ), | |
'parent_item_colon' => __( 'Parent single taxonomy', 'text_domain' ), | |
'edit_item' => __( 'Edit single taxonomy', 'text_domain' ), | |
'update_item' => __( 'Update single taxonomy', 'text_domain' ), | |
'add_new_item' => __( 'Add New single taxonomy', 'text_domain' ), | |
'new_item_name' => __( 'New single taxonomy Name', 'text_domain' ), | |
'add_or_remove_items' => __( 'Add or remove plural taxonomy', 'text_domain' ), | |
'choose_from_most_used' => __( 'Choose from most used plural taxonomy', 'text_domain' ), | |
'menu_name' => __( 'single taxonomy', 'text_domain' ), | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'show_in_nav_menus' => true, | |
'hierarchical' => true, | |
'show_tagcloud' => true, | |
'show_ui' => true, | |
'query_var' => true, | |
'rewrite' => true, | |
'query_var' => true, | |
'capabilities' => '', | |
); | |
register_taxonomy( 'taxonomy-id', array( 'post' ), $args ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment