How to Create Custom Taxonomy in WordPress
This code used for Create Custom Taxonomy and this code add your function.php
file WordPress.
Categories are one of the built-in taxonomies in WordPress, but they only appear in custom posts by default.
We’ll show you how to add categories to a custom post type in WordPress.
<?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 ); ?>
Author: Learn Tutorials Point
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.
Trending Posts
Tags
ACF
Ading custom columns
admin
Bootstrap
Cart Price
categories
Change Price
class
Code
comments
Create
Creating custom post Type
CSS
current
custom
Customizing
Custom Post
Custom Post Type
Custom Taxonomy
database
Date
Fatch
form
function
HTML
Image
Install
javascript
jQuery
Menu
PHP
Post
Post Type
Price
product
responsive
Resular price
Single product
Table
taxonomy
Theme
Title
woocommerce
Wordpress
Wordpress Code