#54003 closed feature request (invalid)
How to Display Error in my WordPress customizer api?
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Customize | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
I have been trying to add error to my wordpress customizer api like this error message I am trying to add custom message when the user enter invalid phone number her is my custom code
$wp_customize->add_setting('basic-banner-callout-phonenumber', array( 'default' => '', 'sanitize_callback' => array( $this, 'sanitize_custom_phonenumber' ), 'validate_callback' => 'valide_custom_phonenumber' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'basic-banner-callout-control-text', array( 'label' => 'PhoneNumber', 'section' => 'basic-banner-callout-section', 'settings' => 'basic-banner-callout-phonenumber', 'type' => 'text', 'input_attrs' => array( 'maxlength' => 10 )`
how could i possible display if empty $input 'You must supply a valid phone number. for example ?
Change History (3)
Note: See
TracTickets for help on using
tickets.
Hi @khawaga, and welcome to WordPress Trac!
To add custom messages for validation errors, be sure that the
validate_callback
adds error messages to theWP_Error
object passed to it. For more details, see the dev note written when the validation API was added to core.Please also note that support for custom development isn't available here in Trac. If you have more questions about your project, you'll be able to find help in the support forums.