Categories
Code WordPress

WordPress: Create a Plugin to Create Custom Taxonomies

An example plugin that demonstrates how to easily add new Taxonomies to your WordPress blog.

An example plugin that demonstrates how to easily add new Taxonomies to your WordPress blog.


<?php
/*
Plugin Name: Yor Custom Taxonomies
Plugin URI: http://stevenword.wpengine.com//
Description: Adds custom taxonomies for your WordPress blog
Version: 1.0.0
Author: Steven Word
Author URI: http://stevenword.wpengine.com/
*/

function skw_build_taxonomies() {

 //VEHICLES
 $vehicle_args = array(
 'label' => 'Vehicles',
 'hierarchical' => true,
 'query_var' => true,
 'rewrite' => array('slug' => 'vehicles')
 );
 register_taxonomy( 'skw_vehicles', 'post', $vehicle_args );

 //BRANDS
 $brand_args = array(
 'label' => 'Brands',
 'hierarchical' => true,
 'query_var' => true,
 'rewrite' => array('slug' => 'brands')
 );
 register_taxonomy( 'skw_brands', 'post', $brand_args );

}
add_action( 'init', 'skw_build_taxonomies', 0 );
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.