Skip to content

Instantly share code, notes, and snippets.

@hmbashar
Created September 19, 2019 15:32
Show Gist options
  • Save hmbashar/8cc5322711a7b5084ba0c1106f893619 to your computer and use it in GitHub Desktop.
Save hmbashar/8cc5322711a7b5084ba0c1106f893619 to your computer and use it in GitHub Desktop.
<?php
function shape_custom_post_taxonomy() {
register_taxonomy(
'testimonial_category', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
'shape-testimonial', //post type name
array(
'hierarchical' => true,
'label' => 'Categories', //Display name
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => 'testimonial-category', // This controls the base slug that will display before each term
'with_front' => true // Don't display the category base before
)
)
);
add_action( 'init', 'shape_custom_post_taxonomy');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment