Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WC_Admin_Attributes::process_edit_attribute()

Edit an attribute.


Description Description


Return Return

(bool|WP_Error)


Top ↑

Source Source

File: includes/admin/class-wc-admin-attributes.php

	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;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.