Skip to content

Instantly share code, notes, and snippets.

@mavinothkumar
Last active September 27, 2019 10:41
Show Gist options
  • Save mavinothkumar/2ea3a5b82b838d8167c252b359adf0ff to your computer and use it in GitHub Desktop.
Save mavinothkumar/2ea3a5b82b838d8167c252b359adf0ff to your computer and use it in GitHub Desktop.
Create a Taxonomy for Custom Post Event
/**
* Create a Taxonomy for Custom Post Event
* Paste this code in Theme function.php
*/
add_action('init', 'create_event_taxonomy', 0);
if ( ! function_exists('create_event_taxonomy')) {
function create_event_taxonomy()
{
register_taxonomy(
'event_category',
'event',
array(
'labels' => array(
'name' => 'Event Category',
'add_new_item' => 'Add New Event Category',
'new_item_name' => "New Event Category"
),
'show_ui' => true,
'show_tagcloud' => false,
'hierarchical' => true
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment