0

I'm trying to add a phone field to a theme's customizer, so far, I was able to add the field in the customize page, but for some reasons, it won't save, whenever I save and went back to check it, the field phone is always blank

I'm just following along some guides from google, but it's not working. Am I missing any additional steps? Are there usual stuffs that prevent this from displaying correctly?

here is the functions.php customize_register

function psht_customize_register( $wp_customize ) {
    $wp_customize->add_setting( 'psht[phone]', array(
        'type' => 'text',
        'sanitize_callback' => 'sanitize_text_field'
    ) );

    $wp_customize->add_control('psht[phone]',
        array(
            'settings' => 'psht[phone]',
            'label'      => __( 'Phone Number' ),
            'section'    => 'title_tagline',
            'type'       =>  'text',
        )
    );
}
add_action( 'customize_register', 'psht_customize_register' );
0

I finally found the answer to it. To those who have the same problem, the solution is not to put a type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.