WordPress Customizer: custom redirection after closing

You might try to use jQuery to change the url behind the Close link.

Another idea would be to use wp_get_referer() to intercept the page loading when you go from customize.php to themes.php by hooking into the load-themes.php action:

add_action( 'load-themes.php', 'my_customize_redirect' );
function my_customize_redirect() {

    if ( strstr( wp_get_referer(), '/wp-admin/customize.php' ) )
    {
            $url = get_admin_url(); // EDIT this to your needs
            wp_safe_redirect( $url );
            exit();
    }

}

Leave a Comment