Created
July 19, 2021 14:58
-
-
Save hellofromtonya/e09c280ac2d0ec2743843f726456c620 to your computer and use it in GitHub Desktop.
Trac ticket 53165 - Test Custom Taxonomy added as a must-use plugin
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
<?php | |
// Location of this code: wp-content/mu-plugins/t53165.php. | |
namespace Test\t53165; | |
add_action( 'init', __NAMESPACE__ . '\register_test_taxonomy' ); | |
function register_test_taxonomy() { | |
$labels = array( | |
'name' => 'Tests', | |
'singular_name' => 'Test', | |
'search_items' => 'Search Tests', | |
'all_items' => 'All Tests', | |
'parent_item' => 'Parent Test', | |
'parent_item_colon' => 'Parent Test:', | |
'edit_item' => 'Edit Test', | |
'update_item' => 'Update Test', | |
'add_new_item' => 'Add New Test', | |
'new_item_name' => 'New Test', | |
'menu_name' => 'Test', | |
); | |
$args = array( | |
'hierarchical' => true, // make it hierarchical (like categories) | |
'labels' => $labels, | |
'public' => true, | |
'show_in_rest' => true, | |
'show_admin_column' => true, | |
'rewrite' => array( 'slug' => 'test' ), | |
); | |
register_taxonomy( 'test', array( 'post' ), $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment