Skip to content

Instantly share code, notes, and snippets.

@certainlyakey
Created March 3, 2014 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save certainlyakey/9335092 to your computer and use it in GitHub Desktop.
Save certainlyakey/9335092 to your computer and use it in GitHub Desktop.
Wordpress - register custom taxonomy for custom post type
//Create categories for books
function create_booktag_taxonomy() {
$labels_booktag = array(
'name' => _x( 'Тэги публикаций', 'taxonomy general name' ),
'singular_name' => _x( 'Тэг публикаций', 'taxonomy singular name' ),
'search_items' => __( 'Искать тэги публикаций' ),
'all_items' => __( 'Все тэги публикаций' ),
'edit_item' => __( 'Редактировать' ),
'update_item' => __( 'Обновить' ),
'add_new_item' => __( 'Добавить тэг публикаций' ),
'new_item_name' => __( 'Название' ),
'menu_name' => __( 'Тэги публикаций' ),
);
register_taxonomy('booktag','book', array(
'hierarchical' => false,
'labels' => $labels_booktag,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'booktag' ),
));
}
add_action( 'init', 'create_booktag_taxonomy', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment