Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #3648
      ianmuscat
      Member

      Hi,

      I’m trying to build a custom taxonomy that is private. The idea is that is exists in the WP admin interface but it is not available on the front-end (or to non-logged in users).

      I’m using the following code to register my taxonomy. I’d like to make particular reference to 'public' => false – This is what does not seem to work. I’m using this based off this WP codex article – https://codex.wordpress.org/Function_Reference/register_taxonomy#Example_Private_Taxonomy

      add_filter('piklist_taxonomies', 'example_products');
      function example_products($taxonomies)
      {
      	$taxonomies[] = array(
      	'post_type' => 'example'
      	,'name' => 'example_products'
      	,'show_admin_column' => true
      	,'public' => false
      	,'configuration' => array(
      		'hide_meta_box' => true
      		,'labels' => piklist('taxonomy_labels', 'Products')
              ,'rewrite' => array(
      			'with_front' => false
      			,'slug' => 'example/product'
      		)
      	)
        );
      return $taxonomies;
      }

      Also, it’s not made clear in the documentation what the reason for the ‘configuration’ array when setting up a taxonomy. I can’t find it in WP’s docs, so I’m assuming it is a Piklist thing, but it’s not clear when something should or shouldn’t go in the configuration array. Furthermore, this doesn’t seem to be in-line with registering post types (since registering post typed does not seem to require the use of the configuration array).

      Any help would be greatly appreciated!
      Ian

    • #3650
      Steve
      Keymaster

      @ianmuscat– I suggest you get it working properly with the standard WordPress function. Then you can port it over to us the Piklist filter if you like.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.