Web Dev Tuts

/ Stuffs About Website Development /

Menu
  • Home
  • Wp Plugins
  • How To
  • FAQ
    • GIT
    • JQuery
    • PHP
    • WooCommerce
    • WordPress
  • Contact Us
Menu

How to Add Category Options for Custom Post Types

Posted on October 8, 2016September 24, 2017 by admin

Adding category options for your custom post type is so easy. If you want your custom posts and the default posts to share the same categories, simply insert the ff. line of code below:

register_taxonomy_for_object_type('category', 'h-articles');

Where: h-articles is the id of your custom post type.

However, if you want to create a separate set of categories for our custom post type, simply add the ff. code snippet:

$args = array('label' => 'Categories', 'labels' => array('name' => 'Category', 'singular_name' => 'Category'), 'hierarchical' => true);
register_taxonomy('article-category', 'h-articles', $args);

Where: h-articles is the id of your custom post type.

Visit here for more options when creating a category option for your custom post type.

Category: Wordpress

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • How to add wp_editor Dynamically
  • How to Hide Certain Pages from Certain Users (WP Dashboard)
  • How to Set Up Gmail SMTP
  • How to Set Up Virtual Host in Localhost & Xampp
  • How to Determine the Current WordPress Version Used
  • AngularJs
  • CSS
  • For Me Only
  • geo location api
  • GIT
  • GoDaddy
  • Hosting
  • How To
  • Javascript
  • JQuery
  • Magento
  • My Notes
  • PHP
  • Private
  • Sass
  • WooCommerce
  • Wordpress
  • Xampp
© 2023 Web Dev Tuts | Powered by Minimalist Blog WordPress Theme