get_available_types(); if(!array_key_exists($taxonomy->attribute_type, $types)) { return; } $taxonomy_name = wc_attribute_taxonomy_name($taxonomy->attribute_name); global $thepostid; //phpcs:ignore WordPress.Security.NonceVerification.Missing -- This hook can access only admin and not possible nonce here $product_id = isset($_POST['post_id']) ? absint($_POST['post_id']) : $thepostid; ?> $slug]); if(is_wp_error($term)) { wp_send_json_error($term->get_error_message()); } else { $term = get_term_by('id', $term['term_id'], $tax); update_term_meta($term->term_id, $type, $swatch); } wp_send_json_success( [ 'msg' => esc_html__('Successfully added', 'shopengine'), 'id' => $term->term_id, 'slug' => $term->slug, 'name' => $term->name, ] ); } public function shopengine_term_template() { global $pagenow, $post; if($pagenow != 'post.php' || (isset($post) && get_post_type($post->ID) != 'product')) { return; } ?>