I am trying to figure out how exactly I can add a button to the top of the theme customizer. The spot I am talking about is where the "close" and "save" buttons are. The ones that are above everything else and directly above the preview panel.

Would this have to be done through a modification of the core WP files or can it be done through the theme and customizer API itself? If it can be done without modifying the core wordpress files then how can I access it?


1 Answer 1


If you take a look at the source code of this part …

do_action( 'customize_controls_print_styles' );
do_action( 'customize_controls_print_scripts' );
<body class="<?php echo esc_attr( $body_class ); ?>">
<div class="wp-full-overlay expanded">
    <form id="customize-controls" class="wrap wp-full-overlay-sidebar">

        <div id="customize-header-actions" class="wp-full-overlay-header">
                $save_text = $wp_customize->is_theme_active() ? __( 'Save &amp; Publish' ) : __( 'Save &amp; Activate' );
                submit_button( $save_text, 'primary save', 'save', false );
            <span class="spinner"></span>
            <a class="back button" href="<?php echo esc_url( $return ? $return : admin_url( 'themes.php' ) ); ?>">
                <?php _e( 'Cancel' ); ?>

… you can see there is no action for this place.

But you can hook into customize_controls_print_scripts and register a new JavaScript that inserts a button.

add_action( 'customize_controls_print_scripts', 'add_customizer_button' );

function add_customizer_button()
    wp_register_script( 'my_customizer_script', plugins_url('/customizer_button.js', __FILE__) );
    wp_enqueue_script( 'my_customizer_script' );
  • Thank you toscho, I wanted to make sure my the code I was using the button for was going to work before hand. I appreciate it. Apr 24, 2013 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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