Filter
rpress_edit_customer_address
On this page
Filters the sanitized customer address before it is saved from the admin.
Applied in rpress_edit_customer() right after rpress_edit_customer_info. The address array is built from the Edit Customer form, then each value is run through sanitize_text_field and the result is stored with the customer. Modify the array to normalise or extend address fields.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$address | array | The customer address fields submitted in the form. |
$customer_id | int | The customer ID being edited. |
Return value#
array. The address fields to save.
Example#
function my_edit_customer_address( $address, $customer_id ) {
if ( isset( $address['postal_code'] ) ) {
$address['postal_code'] = strtoupper( $address['postal_code'] );
}
return $address;
}
add_filter( 'rpress_edit_customer_address', 'my_edit_customer_address', 10, 2 );
Notes#
The available keys depend on the Edit Customer form; every value is passed through sanitize_text_field() afterwards.
Source#
Applied in:
includes/admin/customers/customer-actions.php(line 99), inrpress_edit_customer()
See also#
Was this page helpful?
