[wp-hackers] Customizer Return URL

Frank Bueltge frank at bueltge.de
Wed May 20 15:08:09 UTC 2015

Hello at all.

I work on examples to use the customizer as standard control for different
customization topics on front end. But I can't find a solution to change
the return url, the close icon/button on the customizer.

In the source was asked for a var $return. But how is it possible to change
this? Maybe a reader can help me.

>From the Core, wp-admin/customize.php:

wp_reset_vars( array( 'url', 'return' ) );
$url = wp_unslash( $url );
$url = wp_validate_redirect( $url, home_url( '/' ) );
if ( $return ) {
    $return = wp_unslash( $return );
    $return = wp_validate_redirect( $return );
if ( ! $return ) {

I init the customizer via a menu item below Appearance menu item. I set the
url on add the menu with the hook 'admin_menu' and filter the link to set a
new url, my custom url. The url was set via the code below.

// Create specific url for login view
$login_url = wp_login_url();
$url = add_query_arg(
   urlencode( $login_url ),
   admin_url( 'customize.php' )

Works fine and is also on front end, inside the customizer as return url.
I have played with the follow source to change the return value.

$url = add_query_arg(
   admin_url( 'themes.php' )
I have include this via hook like 'init' or 'customize_register', but no
changes on this value.

But how can I change the return url?
Thanks for hints or examples.
best regards

More information about the wp-hackers mailing list