Filter
uncanny-automator
wwlc_filter_state_field_form_label
Filters the label displayed for the state field on the wholesale registration form.
add_filter( 'wwlc_filter_state_field_form_label', $callback, 10, 1 );
Description
This filter allows developers to customize the label text for the 'State' field within Wholesale Suite forms. Use it to translate the label, add dynamic content, or modify it for specific integrations. It fires when the form's state field is initialized.
Usage
add_filter( 'wwlc_filter_state_field_form_label', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example of how to filter the 'wwlc_filter_state_field_form_label' hook
* to change the label for the State field to "Province".
*
* @param string $label The original label for the State field.
* @return string The modified label for the State field.
*/
add_filter( 'wwlc_filter_state_field_form_label', function( $label ) {
// Check if the original label is indeed 'State' before modifying.
if ( $label === esc_html__( 'State', 'uncanny-automator' ) ) {
// Change the label to "Province".
return esc_html__( 'Province', 'uncanny-automator' );
}
// If the label is something else, return it unchanged.
return $label;
}, 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/integrations/wholesale-suite/helpers/wholesale-suite-helpers.php:145
'label' => apply_filters( 'wwlc_filter_city_field_form_label', esc_html__( 'City', 'uncanny-automator' ) ),
'type' => 'text',
'required' => ( get_option( 'wwlc_fields_require_address_field' ) == 'yes' ) ? true : false,
'active' => ( get_option( 'wwlc_fields_activate_address_field' ) == 'yes' ) ? true : false,
'placeholder' => apply_filters( 'wwlc_filter_city_field_form_placeholder', get_option( 'wwlc_fields_city_placeholder', '' ) ),
),
'wwlc_state' => array(
'label' => apply_filters( 'wwlc_filter_state_field_form_label', esc_html__( 'State', 'uncanny-automator' ) ),
'type' => 'text',
'required' => ( get_option( 'wwlc_fields_require_address_field' ) == 'yes' ) ? true : false,
'active' => ( get_option( 'wwlc_fields_activate_address_field' ) == 'yes' ) ? true : false,
'placeholder' => apply_filters( 'wwlc_filter_state_field_form_placeholder', get_option( 'wwlc_fields_state_placeholder', '' ) ),
),
'wwlc_postcode' => array(
'label' => apply_filters( 'wwlc_filter_postcode_field_form_label', esc_html__( 'Postcode', 'uncanny-automator' ) ),