Redirect after closing Theme Customizer when user does not have permission for theme page

You can try this jQuery script injected via the customize_controls_print_footer_scripts hook:

/**
 * Change the url of the Close link in the /wp-admin/customize.php page
 * See http://wordpress.stackexchange.com/q/116257
 */
function change_close_url_wpse_116257() {
    $url = get_admin_url(); // Edit this to your needs
    printf( "<script>
                jQuery(document).ready( function(){ 
                    jQuery('#customize-header-actions a.back.button').attr('href', '%s'); 
                });
            </script>"
            , esc_js( $url ) );     
}
add_action( 'customize_controls_print_footer_scripts', 'change_close_url_wpse_116257' );

Leave a Comment