Advanced: Customizer control type oddity
-
In the customizer, I have added a setting/control to my section. I have set the control type to url. Briefly:
$wp_customize->add_setting( 'my_url_field', array( 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'my_url_field', array( 'label' => 'Enter Your URL', 'section' => 'my_section', 'type' => 'url', ) );As I type my entry into this field, unlike in other fields, the Save & Publish button does not come to life — it remains grayed out at Saved — and the live preview does not happen. Until, that is, I click outside of this field — then the button highlights and the contents show in the live preview.
Per the customizer api:
For any input type supported by the html element, simply pass the type attribute value to the type parameter when adding the control. This allows support for control types such as text, hidden, number, range, url, tel, email, search, time, date, datetime, and week, pending browser support.
So these control types work as expected: text, number, range, time, date, datetime, week.
And these control types work (or rather don’t work) as I described above: url, tel, email, search.
What gives?
The topic ‘Advanced: Customizer control type oddity’ is closed to new replies.