Area taxonomy for Properties

Home » Snippets » Area taxonomy for Properties
0

Created with:

Taxonomy generator

Visibility: 

public

Creator: Muhammad Raheem

Customize with WPTurbo AI
X

Add Snippet To Project

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

	$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' => 'property_area',
		'rest_controller_class' => 'WP_REST_property_area_Terms_Controller',
	];

	register_taxonomy( 'property_area', ['property_post'], $args );
}
add_action( 'init', 'wpturbo_register_my_taxonomy' );
			

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