wordpress - Restrict posting in one taxonomy -


i have 2 taxonomies custom post type. 1 categories , other called types. restrict author able select 1 of 2 taxonomies.

for example, if author selects 1 of "types" taxonomy, not able select "categories"

is possible?

you need create custom taxonomy custom post type only: here working code me. display custom taxonomy custom post type.

// registers new post type , taxonomy function wpt_packages_posttype() {   register_post_type( 'packages',     array(       'labels' => array(         'name' => __( 'packages' ),         'singular_name' => __( 'packages' ),         'add_new' => __( 'add new packages' ),         'add_new_item' => __( 'add new packages' ),         'edit_item' => __( 'edit packages' ),         'new_item' => __( 'add new packages' ),         'view_item' => __( 'view packages' ),         'search_items' => __( 'search packages' ),         'not_found' => __( 'no packages found' ),         'not_found_in_trash' => __( 'no packages found in trash' )       ),       'taxonomies' => array('package-category'),       'public' => true,       'supports' => array( 'title', 'editor', 'thumbnail', 'comments' ),       'capability_type' => 'post',       'rewrite' => array("slug" => "packages"), // permalinks format       'menu_position' => 5,     )   ); }  add_action( 'init', 'wpt_packages_posttype' );      function add_console_taxonomies() {    register_taxonomy('package-category', 'review', array(     // hierarchical taxonomy (like categories)     'hierarchical' => true,     // array of options controls labels displayed in wordpress admin ui     'labels' => array(       'name' => _x( 'package category', 'taxonomy general name' ),       'singular_name' => _x( 'package category', 'taxonomy singular name' ),       'search_items' =>  __( 'search package categories' ),       'all_items' => __( 'all package categories' ),       'parent_item' => __( 'parent package category' ),       'parent_item_colon' => __( 'parent package-category:' ),       'edit_item' => __( 'edit package category' ),       'update_item' => __( 'update package category' ),       'add_new_item' => __( 'add new package category' ),       'new_item_name' => __( 'new package category name' ),       'menu_name' => __( 'package categories' ),     ),      // control slugs used taxonomy     'rewrite' => array(       'slug' => 'package-category', // controls base slug display before each term       'with_front' => false, // don't display category base before "/locations/"       'hierarchical' => true // allow url's "/locations/boston/cambridge/"     ),   )); } add_action( 'init', 'add_console_taxonomies', 0 ); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -