Join WhatsApp ChannelJoin Now

How to Create Taxonomies In WordPress

Hello Dev,

Today, i we will show you how to create taxonomies in wordpress. This article will give you simple example of how to create taxonomies in wordpress. you will learn how to create taxonomies in wordpress. So let’s follow few step to create example of how to create taxonomies in wordpress.

Create Taxonomies In WordPress

Add Code functions.php file:

add_action( 'init', 'create_codeplaners' );

// create taxonomies, codeplaners and writers for the post type "codeplaners"
function create_codeplaners() {
	// Add new taxonomy, make it hierarchical (like categories)
	$labels = array(
		'name' => _x( 'CodePlaners', 'post type codeplaners name' ),
		'singular_name' => _x('CodePlaners', 'post type singular name'),
    	'add_new' => _x('Add New', 'CodePlaners'),
		'add_new_item' => __('Add New CodePlaners'),
   		'edit_item' => __('Edit CodePlaners'),
    	'new_item' => __('New CodePlaners'),
		'view_item' => __('View CodePlaners'),
		'search_items' => __('Search CodePlaners'),
		'not_found' =>  __('No CodePlaners found'),
		'not_found_in_trash' => __('No Events found in Trash'),
		'parent_item_colon' => ''

	);
 $supports = array('title','editor','excerpt',	'trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes');
  register_post_type( 'CodePlaners',
    array(
      'labels' => $labels,
      'public' => true,
      'supports' => $supports,
	  'rewrite' => false,
    )
  );
}

Recommended Posts