Home / Admin / Add Custom Taxonomy – Single Vendor Taxonomy
Duplicate Snippet

Embed Snippet on Your Site

Add Custom Taxonomy – Single Vendor Taxonomy

It'll only allow the vendor to select one custom taxonomy term at a time

Code Preview
php
<?php
/**
 * Add the custom taxonomy to the WC Vendors Pro dashboard. 
 *
 */
function wcv_add_brands_field( $object_id ){ 
	WCVendors_Pro_Form_helper::select2( 
        array(
            'post_id'			=> $object_id,
            'id'				  => '_wcv_custom_taxonomy_wcv_brands[]',
            'class'				=> 'select2',
            'custom_tax'  => true, 
            'label'				=> __( 'Brand', 'wcvendors-pro' ),
            'taxonomy'		=>	'wcv_brands', 
            'taxonomy_args'		=> array( 
                    'hide_empty'	=> 0, 
                ),
		)
	);
}
// Hook into the form after product tags to display the field 
add_action( 'wcv_after_product_details', 'wcv_add_brands_field' );

Comments

Add a Comment