Filter uncanny-automator

wwlc_filter_email_field_form_label

Filters the label displayed for the email field in forms, allowing customization before it's shown to users.

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

Description

Filters the label displayed for the email field in forms. Use this hook to customize the email field's label text, such as for internationalization or specific branding needs. This hook fires during form rendering.


Usage

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

Return Value

The filtered value.


Examples

<?php

/**
 * Example of how to use the wwlc_filter_email_field_form_label hook
 * to change the label of the email field in a WordPress form.
 *
 * In this example, we'll append "(Required)" to the default email label
 * if the email field is marked as required.
 */
add_filter( 'wwlc_filter_email_field_form_label', 'custom_email_field_label', 10, 1 );

function custom_email_field_label( $original_label ) {
	// Check if the email field is marked as required in the WordPress options.
	// This assumes there's a specific option for this, adjust if the logic is different.
	if ( get_option( 'wwlc_fields_require_email_field' ) === 'yes' ) {
		// Append "(Required)" to the label if it's required.
		return $original_label . ' (Required)';
	}

	// Otherwise, return the original label.
	return $original_label;
}

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

'label'       => apply_filters( 'wwlc_filter_phone_field_form_label', esc_html__( 'Phone', 'uncanny-automator' ) ),
				'type'        => 'phone',
				'required'    => ( get_option( 'wwlc_fields_require_phone_field' ) == 'yes' ) ? true : false,
				'active'      => true,
				'placeholder' => ( get_option( 'wwlc_fields_phone_field_placeholder' ) ) ? get_option( 'wwlc_fields_phone_field_placeholder' ) : '',
			),
			'user_email'        => array(
				'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' ) ),


Scroll to Top