'edit_product', 'read_post' => 'read_product', 'delete_post' => 'delete_product', 'edit_posts' => 'edit_products', 'edit_others_posts' => 'edit_others_products', 'publish_posts' => 'publish_products', 'read_private_posts' => 'read_private_products', 'create_posts' => 'create_products', // use `create_products` instead of default `edit_products` ); $args['supports'] = array( 'title', 'thumbnail' ); return $args; } /** * Hide default metabox for product tags * * @param $args * * @return array */ public static function manage_tags_as_references($args) { // hide metabox $args['meta_box_cb'] = false; // update labels $args['labels'] = array( 'name' => __( 'Product references', 'wiaas' ), 'singular_name' => __( 'Reference', 'wiaas' ), 'menu_name' => _x( 'References', 'Admin menu name', 'wiaas' ), 'search_items' => __( 'Search references', 'wiaas' ), 'all_items' => __( 'All references', 'wiaas' ), 'edit_item' => __( 'Edit reference', 'wiaas' ), 'update_item' => __( 'Update reference', 'wiaas' ), 'add_new_item' => __( 'Add new reference', 'wiaas' ), 'new_item_name' => __( 'New reference name', 'wiaas' ), 'popular_items' => __( 'Popular references', 'wiaas' ), 'separate_items_with_commas' => __( 'Separate references with commas', 'wiaas' ), 'add_or_remove_items' => __( 'Add or remove references', 'wiaas' ), 'choose_from_most_used' => __( 'Choose from the most used references', 'wiaas' ), 'not_found' => __( 'No references found', 'wiaas' ), ); return $args; } public static function get_supplier_id($product_id){ return wp_get_post_terms($product_id, 'supplier', array('fields' => 'ids'))[0]; } } Wiaas_Product::init();