WC_Admin_Attributes::process_edit_attribute
Edit an attribute.
Method of the class: WC_Admin_Attributes{}
No Hooks.
Returns
true|false|WP_Error.
Usage
$result = WC_Admin_Attributes::process_edit_attribute();
WC_Admin_Attributes::process_edit_attribute() WC Admin Attributes::process edit attribute code WC 10.6.2
private static function process_edit_attribute() {
$attribute_id = isset( $_GET['edit'] ) ? absint( $_GET['edit'] ) : 0;
check_admin_referer( 'woocommerce-save-attribute_' . $attribute_id );
$attribute = self::get_posted_attribute();
$args = array(
'name' => $attribute['attribute_label'],
'slug' => $attribute['attribute_name'],
'type' => $attribute['attribute_type'],
'order_by' => $attribute['attribute_orderby'],
'has_archives' => $attribute['attribute_public'],
);
$id = wc_update_attribute( $attribute_id, $args );
if ( is_wp_error( $id ) ) {
return $id;
}
self::$edited_attribute_id = $id;
return true;
}