Use wc_get_attribute_taxonomies instead of global
This commit is contained in:
parent
23f6544ffc
commit
3bd52a78a5
|
@ -22,8 +22,6 @@ class WC_Admin_Taxonomies {
|
|||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
global $wc_product_attributes;
|
||||
|
||||
// Category/term ordering
|
||||
add_action( 'create_term', array( $this, 'create_term' ), 5, 3 );
|
||||
add_action( 'delete_term', array( $this, 'delete_term' ), 5 );
|
||||
|
@ -42,8 +40,12 @@ class WC_Admin_Taxonomies {
|
|||
add_action( 'product_cat_pre_add_form', array( $this, 'product_cat_description' ) );
|
||||
add_action( 'product_shipping_class_pre_add_form', array( $this, 'shipping_class_description' ) );
|
||||
|
||||
foreach ( array_keys( $wc_product_attributes ) as $attribute ) {
|
||||
add_action( $attribute . '_pre_add_form', array( $this, 'product_attribute_description' ) );
|
||||
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
||||
|
||||
if ( $attribute_taxonomies ) {
|
||||
foreach ( array_keys( $attribute_taxonomies ) as $attribute ) {
|
||||
add_action( $attribute . '_pre_add_form', array( $this, 'product_attribute_description' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// Maintain hierarchy of terms
|
||||
|
|
Loading…
Reference in New Issue