Skip to content

Instantly share code, notes, and snippets.

@taricco
Last active February 18, 2024 15:17
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 taricco/4dcd3793a51ea695e0c645e14834ed54 to your computer and use it in GitHub Desktop.
Save taricco/4dcd3793a51ea695e0c645e14834ed54 to your computer and use it in GitHub Desktop.
/*** Create "Event Tag" for Event CPT
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/
function create_event_tags_taxonomy() {
register_taxonomy(
'event_tags', // Taxonomy key
'event', // Post type name
array(
'label' => __( 'Event Tags' ),
'rewrite' => array( 'slug' => 'event-tag' ),
'hierarchical' => false, // Set to false for tags, true for categories
'show_in_rest' => true, // Important for block editor/Gutenberg
)
);
}
add_action( 'init', 'create_event_tags_taxonomy', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment