Created
November 1, 2021 03:11
-
-
Save jasperf/1e60dec8799a2f21b5d964c58d0bd5d8 to your computer and use it in GitHub Desktop.
CPT Events Category Taxonomy made with CPT UI
This file contains hidden or 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 cptui_register_my_taxes_event_category() { | |
/** | |
* Taxonomy: Event Categories. | |
*/ | |
$labels = [ | |
"name" => __( "Event Categories", "custom-post-type-ui" ), | |
"singular_name" => __( "Event Category", "custom-post-type-ui" ), | |
]; | |
$args = [ | |
"label" => __( "Event Categories", "custom-post-type-ui" ), | |
"labels" => $labels, | |
"public" => true, | |
"publicly_queryable" => true, | |
"hierarchical" => false, | |
"show_ui" => true, | |
"show_in_menu" => true, | |
"show_in_nav_menus" => true, | |
"query_var" => true, | |
"rewrite" => [ 'slug' => 'event_category', 'with_front' => true, ], | |
"show_admin_column" => false, | |
"show_in_rest" => true, | |
"rest_base" => "event_category", | |
"rest_controller_class" => "WP_REST_Terms_Controller", | |
"show_in_quick_edit" => true, | |
"show_in_graphql" => false, | |
]; | |
register_taxonomy( "event_category", [ "event" ], $args ); | |
} | |
add_action( 'init', 'cptui_register_my_taxes_event_category' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment