Latest Post

How to Create Custom Taxonomy in Wordpress

How to Create Custom Taxonomy in Wordpress

How to Create Custom Taxonomy in Wordpress


This code use for Create Custom Taxonomy.

<?php

function add_console_taxonomies() {

register_taxonomy('console', 'test', array(
// Hierarchical taxonomy (like categories)
'hierarchical' => true,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => _x( 'Sale Listings Category', 'taxonomy general name' ),
'singular_name' => _x( 'Sale-Listings-Category', 'taxonomy singular name' ),
'search_items' =>  __( 'Search Sale-Listings-Category' ),
'all_items' => __( 'All Sale-Listings-Category' ),
'parent_item' => __( 'Parent Sale-Listings-Category' ),
'parent_item_colon' => __( 'Parent Sale-Listings-Category:' ),
'edit_item' => __( 'Edit Sale-Listings-Category' ),
'update_item' => __( 'Update Sale-Listings-Category' ),
'add_new_item' => __( 'Add New Sale-Listings-Category' ),
'new_item_name' => __( 'New Sale-Listings-Category Name' ),
'menu_name' => __( 'Sale Listings Categories' ),
),

// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'test', // This controls the base slug that will display before each term
'with_front' => false, // Don't display the category base before "/locations/"
'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
),
));
}

add_action( 'init', 'add_console_taxonomies', 0 );

?>

No comments