Adding a custom field to the site identity menu

You’ll have to add your own customizer controls to achieve that.

So for example, if you want to add Company Name, you can use this code:

function my_register_additional_customizer_settings( $wp_customize ) {
    $wp_customize->add_setting(
        'my_company_name',
        array(
            'default' => '',
            'type' => 'option', // you can also use 'theme_mod'
            'capability' => 'edit_theme_options'
        ),
    );

    $wp_customize->add_control( new WP_Customize_Control(
        $wp_customize,
        'my_company_name',
        array(
            'label'      => __( 'Company name', 'textdomain' ),
            'description' => __( 'Description for your field', 'textdomain' ),
            'settings'   => 'my_company_name',
            'priority'   => 10,
            'section'    => 'title_tagline',
            'type'       => 'text',
        )
    ) );
}
add_action( 'customize_register', 'my_register_additional_customizer_settings' );

PS. Here you can find more docs regarding this topic: Theme Customization API

Leave a Comment