Merge pull request #21192 from woocommerce/fix/20979

Restrict category creation in importer to appropriate permissions
This commit is contained in:
Rodrigo Primo 2018-08-29 11:27:49 -03:00 committed by GitHub
commit e3cbebf29e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -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 ) ) );