Make WordPress Core

Opened 7 months ago

Last modified 2 months ago

#25457 new enhancement

Add a filter to the Close link in wp-admin/customize.php

Reported by: birgire Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.6.1
Component: Appearance Keywords: has-patch close
Focuses: Cc:


It would be handy to be able to change the href attribute of the close link in the theme customizer in /wp-admin/customize.php, so you wouldn't have to use some jQuery hacking: http://wordpress.stackexchange.com/q/115731 or redirecting: http://wordpress.stackexchange.com/q/115731.

Attachments (2)

customize.diff (1.2 KB) - added by birgire 7 months ago.
customize.php diff
customize_v2.diff (1.1 KB) - added by birgire 7 months ago.

Download all attachments as: .zip

Change History (10)

birgire7 months ago

customize.php diff

comment:1 SergeyBiryukov7 months ago

  • Component changed from General to Appearance

birgire7 months ago


comment:2 helen7 months ago

  • Keywords close added

I'm not sure I understand this - you can pass a URL as it is and it will be used, e.g. http://example.com/wp-admin/customize.php?url=http%3A%2F%2Fexample.com%2F. I would be against filtering the return location from other links - users should have a consistent experience.

comment:3 helen7 months ago

  • Keywords reporter-feedback added

Meant to ask - use case?

comment:4 birgire7 months ago

Hi Helen, thanks for your comment.

My user-experience is that the Theme Customizer feels like a fullscreen popup with a close button.
When I close it, I expect to go back to the previous page.

Let's say the user is on the page /wp-admin/widgets.php and clicks on the Theme Customizer link in the admin menu. The Theme Customizer opens up and when the user closes it, he's taken to the page /wp-admin/themes.php instead of the page /wp-admin/widgets.php where he started.

So this is the case when $return is empty.

By having a filter on the Close link, the user could for example use the referred page instead.

Or better yet, use the referred page instead of the default admin_url( 'themes.php' ).

I should have described this better in the first place, I hope this makes sense ;-)

comment:5 birgire7 months ago

  • Keywords reporter-feedback removed

comment:6 helen7 months ago

So should we be setting the url query arg, then? It does make sense to me that you should return whence you came - drives me crazy that you go from the Dashboard welcome panel to Customize to Themes.

Last edited 7 months ago by helen (previous) (diff)

comment:7 birgire6 months ago

I agree, the user experince should be consistent and predictable.

Few things that come to mind, like these two different approaches:

a) I wonder if it would make sense to replace customize.php with customize.php?url=#current_page_url#
in the admin-menu. Example: if we are on the admin page widgets.php then the admin menu link for Customize will be customize.php?url=widgets.php.

b) Perhaps we can use wp_get_referer(), so instead of

$return ? $return : admin_url( 'themes.php' )

in wp-admin/customize.php, we could try:

$return ? $return : $close_url

or if we want it to be filterable:

$return ? $return : apply_filters( 'wp_customize_close_url', $close_url )


$close_url = ( wp_get_referer() ) ? wp_get_referer() : admin_url( 'themes.php' )

comment:8 ircbot2 months ago

This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.

Note: See TracTickets for help on using tickets.