creating custom taxonomy for custom post type
-
Website currently unavailable. I am trying to create a custom taxonomy (actually multiple and would also like insight for multiple, as well, please). I used a plugin to generate the code and copied and pasted it into my plugin I am attempting to write. What am I doing wrong? A little preview of code:
defined( 'ABSPATH' ) or die( 'Oops How did you get here? You Are Not Authorized Access.' ); class odsmbr { //adding the custom taxonomy for ods product databases function register_ods_taxonomy_product() { /** * Taxonomy: product. */ $labels = array( "name" => __( "product", "" ), "singular_name" => __( "product", "" ), ); $args = array( "label" => __( "product", "" ), "labels" => $labels, "public" => true, "hierarchical" => false, "label" => "product", "show_ui" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "query_var" => true, "rewrite" => array( 'slug' => 'product', 'with_front' => true, ), "show_admin_column" => false, "show_in_rest" => false, "rest_base" => "product", "show_in_quick_edit" => false, ); register_taxonomy( "product", array( "odsdatabase" ), $args ); } add_action( 'init', 'register_ods_taxonomy_product' ); //adding the ondash custom post type for member contribution to databases function __construct(){ add_action( 'init', array($this, 'ods_custom_post')); } function activate() { // generated a CPT // flush rewrite rules flush_rewrite_rules(); }
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘creating custom taxonomy for custom post type’ is closed to new replies.