vic4884
1/14/2019 - 8:51 AM

custom taxonomy post type

<?php 
/*
Кастомные таксономии
*/

function movie_taxonomy()
{
    $labels = [
        'name'              => _x('Ganre', 'taxonomy general name'),
        'singular_name'     => _x('Ganre', 'taxonomy singular name'),
        'search_items'      => __('Search Ganre'),
        'all_items'         => __('All Ganre'),
        'parent_item'       => __('Parent Ganre'),
        'parent_item_colon' => __('Parent Ganre:'),
        'edit_item'         => __('Edit Ganre'),
        'update_item'       => __('Update Ganre'),
        'add_new_item'      => __('Add New Ganre'),
        'new_item_name'     => __('New Ganre Name'),
        'menu_name'         => __('Ganre'),
        ];
        $args = [
        'hierarchical'      => true, // make it hierarchical (like categories)
        'labels'            => $labels,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        //'rewrite'           => ['slug' => 'genres'],
        ];
  register_taxonomy('genre', ['movie'], $args);
}
add_action('init', 'movie_taxonomy');