[wp-trac] [WordPress Trac] #54003: How to Display Error in my WordPress customizer api?

WordPress Trac noreply at wordpress.org
Wed Aug 25 11:35:48 UTC 2021


#54003: How to Display Error in my WordPress customizer api?
-----------------------------+-----------------------------
 Reporter:  khawaga          |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 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 ?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54003>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list