Merge pull request #21192 from woocommerce/fix/20979
Restrict category creation in importer to appropriate permissions
This commit is contained in:
commit
e3cbebf29e
|
@ -362,6 +362,9 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
|
||||
if ( is_array( $term ) ) {
|
||||
$term_id = $term['term_id'];
|
||||
// Don't allow users without capabilities to create new categories.
|
||||
} elseif ( ! current_user_can( 'manage_product_terms' ) ) {
|
||||
break;
|
||||
} else {
|
||||
$term = wp_insert_term( $_term, 'product_cat', array( 'parent' => intval( $parent ) ) );
|
||||
|
||||
|
|
Loading…
Reference in New Issue