Created
March 18, 2024 04:09
-
-
Save carolinan/113c529165d7b88b331aae39d5587c6f to your computer and use it in GitHub Desktop.
Register taxonomy
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
// Add Level taxonomy to pages. | |
function fsecom_register_taxonomy_level() { | |
$labels = array( | |
'name' => _x( 'Level', 'taxonomy general name' ), | |
'singular_name' => _x( 'Level', 'taxonomy singular name' ), | |
'search_items' => __( 'Search Levels' ), | |
'all_items' => __( 'All Levels' ), | |
'edit_item' => __( 'Edit Level' ), | |
'update_item' => __( 'Update Level' ), | |
'add_new_item' => __( 'Add New Level' ), | |
'new_item_name' => __( 'New Level Name' ), | |
'menu_name' => __( 'Levels' ), | |
); | |
$args = array( | |
'hierarchical' => false, | |
'labels' => $labels, | |
'public' => true, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'show_in_rest' => true, | |
); | |
register_taxonomy( 'level', [ 'page' ], $args ); | |
} | |
add_action( 'init', 'fsecom_register_taxonomy_level' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment