Filter uncanny-automator

wwlc_filter_username_form_label

Filters the label displayed for the username field on forms, allowing customization.

add_filter( 'wwlc_filter_username_form_label', $callback, 10, 1 );

Description

Filters the label displayed for the username field in Wholesale Suite forms. Developers can modify this label to customize the user interface, perhaps for localization or to provide more specific field instructions. The default label is 'Username'.


Usage

add_filter( 'wwlc_filter_username_form_label', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

/**
 * Example of how to hook into the 'wwlc_filter_username_form_label' filter.
 * This example appends "(required)" to the username label if the field is marked as required.
 */
add_filter( 'wwlc_filter_username_form_label', function( $label ) {
	// Check if the username field is actively required in the WordPress options.
	// We're assuming a custom option 'wwlc_fields_username_required' exists.
	// In a real scenario, you'd need to verify the exact option name.
	if ( get_option( 'wwlc_fields_username_required' ) === 'yes' ) {
		// Append "(required)" to the label if it's marked as required.
		$label .= ' (required)';
	}

	// Return the potentially modified label.
	return $label;
}, 10, 1 ); // Priority 10, accepts 1 argument.

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:103

'label'       => apply_filters( 'wwlc_filter_email_field_form_label', esc_html__( 'Email', 'uncanny-automator' ) ),
				'type'        => 'email',
				'required'    => true,
				'active'      => true,
				'placeholder' => ( get_option( 'wwlc_fields_email_field_placeholder' ) ) ? get_option( 'wwlc_fields_email_field_placeholder' ) : '',
			),
			'wwlc_username'     => array(
				'label'       => apply_filters( 'wwlc_filter_username_form_label', esc_html__( 'Username', 'uncanny-automator' ) ),
				'type'        => 'text',
				'required'    => true,
				'active'      => ( get_option( 'wwlc_fields_username_active' ) == 'yes' ) ? true : false,
				'placeholder' => ( get_option( 'wwlc_fields_username_placeholder' ) ) ? get_option( 'wwlc_fields_username_placeholder' ) : '',
			),
			'wwlc_company_name' => array(
				'label'       => apply_filters( 'wwlc_filter_company_field_form_label', esc_html__( 'Company name', 'uncanny-automator' ) ),


Scroll to Top