Created
May 31, 2018 21:26
-
-
Save erishel/a972df12cca6f86de46212d5eecdf001 to your computer and use it in GitHub Desktop.
This file contains 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
function vehicle_details() { | |
// Add new "Vehicle Details" taxonomy | |
register_taxonomy('vehicle_details', 'vehicle', array( | |
// Hierarchical taxonomy (like categories) | |
'hierarchical' => true, | |
'public' => true, | |
'capabilities' => array ( | |
'manage_terms' => 'manage_categories', //by default only admin | |
'edit_terms' => 'manage_vehicles', | |
'delete_terms' => 'manage_vehicles', | |
'assign_terms' => 'edit_vehicles' | |
), | |
// This array of options controls the labels displayed in the WP Admin UI | |
'labels' => array( | |
'name' => _x( 'Vehicle Details', 'taxonomy general name' ), | |
'singular_name' => _x( 'Vehicle Detail', 'taxonomy singular name' ), | |
'search_items' => __( 'Search Vehicle Detail' ), | |
'all_items' => __( 'All Vehicle Details' ), | |
'parent_item' => __( 'Parent' ), | |
'parent_item_colon' => __( 'Parent:' ), | |
'edit_item' => __( 'Edit Vehicle Detail' ), | |
'update_item' => __( 'Update Vehicle Detail' ), | |
'add_new_item' => __( 'Add New Vehicle Detail' ), | |
'new_item_name' => __( 'New Vehicle Detail Name' ), | |
'menu_name' => __( 'Vehicle Details' ), | |
), | |
// Control the slugs used for this taxonomy | |
'rewrite' => array( | |
'slug' => 'vehicle-details', // This controls the base slug that will display before each term | |
'with_front' => false, // Don't display the category base before "/vehicle-details/" | |
'hierarchical' => true // This will allow URL's like "/color/blue/lightblue/" | |
), | |
)); | |
} | |
add_action( 'init', 'vehicle_details', 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment