Objects Taxonomy

WPTurbo » Snippets » Objects Taxonomy
0

Created with:

Taxonomy generator

Visibility: 

public

Creator: Stephen

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
				/**
 * Registers the 'objects' taxonomy.
 * 
 * @return void
 */
function astropress_register_objects() : void {
	$labels = [
		'name' => _x( 'Objects', 'Taxonomy Name', 'astropress' ),
		'singular_name' => _x( 'Object', 'Taxonomy Singular Name', 'astropress' ),
		'menu_name' => __( 'Objects ', 'astropress' ),
		'all_items' => __( 'All Objects ', 'astropress' ),
		'parent_item' => __( 'Parent Object ', 'astropress' ),
		'parent_item_colon' => __( 'Parent Object: ', 'astropress' ),
		'new_item_name' => __( 'New Object ', 'astropress' ),
		'add_new_item' => __( 'Add New Object ', 'astropress' ),
		'edit_item' => __( 'Edit Object ', 'astropress' ),
		'update_item' => __( 'Update Object ', 'astropress' ),
		'view_item' => __( 'View Object ', 'astropress' ),
		'add_or_remove_items' => __( 'Add or Remove Objects ', 'astropress' ),
		'choose_from_most_used' => __( 'Choose from most used Objects ', 'astropress' ),
		'popular_items' => __( 'Popular Objects ', 'astropress' ),
		'search_items' => __( 'Search Objects ', 'astropress' ),
		'not_found' => __( 'Not Found ', 'astropress' ),
		'no_terms' => __( 'No Objects ', 'astropress' ),
		'items_list' => __( 'Objects List ', 'astropress' ),
		'items_list_navigation' => __( 'Objects List Navigation ', 'astropress' ),
	];

	$args = [
		'labels' => $labels,
		'hierarchical' => true,
		'public' => true,
		'show_ui' => true,
		'show_admin_column' => true,
		'show_in_nav_menus' => true,
		'show_tagcloud' => true,
		'show_in_rest' => true,
		'rest_base' => 'objects',
		'rest_controller_class' => 'WP_REST_Terms_Controller',
		'update_count_callback' => '_update_generic_term_count',
	];

	register_taxonomy( 'objects', ['captures'], $args );
}
add_action( 'init', 'astropress_register_objects' );
			

Register an account to save your snippets or go Pro to get more features.