Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

chrismichaels84 on "Custom Taxonomy public or private?"

$
0
0

I have created a number of custom post types (stories, authors, reviews, and news). Stories acts as a master or primary for the others. I have also created a custom taxonomy for "stories" called "stories_master" that is hierarchical like categories. I then, attached that taxonomy to my other post types. All is fantastic.

What I am trying to do is make the "stories_master" taxonomy visible in the post area (for new or edit reviews, authors, etc), but NOT visible under the administration menus. I don't want users to be able to add categories in the taxonomy. The plugin creates the categories. Does that make sense? So far, I can get one or the other to work.

Here is the relevant code:

/** Here is where I create the taxonomy and attach it to the master "stories" custom post type **/

add_action( 'init', function () {

// Create the slug
$sanatized = "stories_master";

// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
    //with all my labels
);

$args = array(
	'labels' => $labels,
	'public' => true,
	'show_in_nav_menus' => false,
	'show_ui' => true,
	'show_tagcloud' => false,
	'show_admin_column' => true,
	'hierarchical' => true,

	'rewrite' => true,
	'query_var' => true
    );

register_taxonomy( $sanatized, array( 'stories' ), $args );
register_taxonomy_for_object_type( $sanatized, 'stories' );

/** When I create the other post types "authors, reviews, etc", I add this taxonomy like so: **/
'taxonomies'	    => array( 'post_tag', 'stories_master' )

Is what I am trying to do even possible? Is there a work around? I guess I could just manually remove the link from the menus.


Viewing all articles
Browse latest Browse all 8245

Trending Articles