Customize: Return user to referring URL when leaving Customizer in absence of return query param.

When referring URL is not available, default returning user to frontend URL instead of admin URL. Themes page is updated to include the `return` path in Customizer links.

Props McGuive7, westonruter.
Fixes #32637.

Built from https://develop.svn.wordpress.org/trunk@35483


git-svn-id: http://core.svn.wordpress.org/trunk@35447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter
2015-11-01 06:40:28 +00:00
parent 10f3ff1753
commit 8fed77574c
4 changed files with 17 additions and 6 deletions

View File

@@ -1473,14 +1473,15 @@ final class WP_Customize_Manager {
* @return string URL for link to close Customizer.
*/
public function get_return_url() {
$referer = wp_get_referer();
if ( $this->return_url ) {
$return_url = $this->return_url;
} else if ( $referer ) {
$return_url = $referer;
} else if ( $this->preview_url ) {
$return_url = $this->preview_url;
} else if ( current_user_can( 'edit_theme_options' ) || current_user_can( 'switch_themes' ) ) {
$return_url = admin_url( 'themes.php' );
} else {
$return_url = admin_url();
$return_url = home_url( '/' );
}
return $return_url;
}