[wp-trac] [WordPress Trac] #32637: Customizer should default to returning to the front page, not the themes page

WordPress Trac noreply at wordpress.org
Thu Sep 3 07:09:39 UTC 2015


#32637: Customizer should default to returning to the front page, not the themes
page
---------------------------------------------------+------------------
 Reporter:  celloexpressions                       |       Owner:
     Type:  defect (bug)                           |      Status:  new
 Priority:  normal                                 |   Milestone:  4.4
Component:  Customize                              |     Version:  4.0
 Severity:  normal                                 |  Resolution:
 Keywords:  good-first-bug has-patch dev-feedback  |     Focuses:  ui
---------------------------------------------------+------------------

Comment (by westonruter):

 If we want the Customizer to be more closely aligned with the frontend
 instead of the admin, then I think this condition should be removed:

 {{{
 ( current_user_can( 'edit_theme_options' ) || current_user_can(
 'switch_themes' ) ) ||
 }}}

 By default every user accessing the Customizer will have
 `edit_theme_options`, as the `customize` capability from #28605 is a meta
 capability only available  to users with `edit_theme_options` by default
 unless explicitly granted by plugin (see #32739). So for the vast majority
 of users this patch would have no effect at all, other than to redirect
 them to the admin dashboard as opposed to the themes page if they landed
 on `customize.php` directly (via bookmark).

 Replying to [comment:9 celloexpressions]:
 > This looks fine for 4.4.
 >
 > I wonder if we could easily always detect the referer and go back to the
 previous page, rather than passing return query args all over the place.
 If that's feasible, a new ticket should be made for that.

 Actually, we have this in the `wp_get_referer()` function. So given above,
 I think we could implement the logic for determining `$return` if it is
 not explicitly provided via:

 {{{
 $referer = wp_get_referer();
 if ( $url ) {
         $return = $url;
 } elseif ( $referer ) {
         $return = $referer;
 } elseif ( current_user_can( 'edit_theme_options' ) || current_user_can(
 'switch_themes' ) ) {
         $return = admin_url( 'themes.php' );
 } else {
         $return = home_url();
 }
 }}}

 But to me, I think that the redirect to `admin_url()` might as well be
 removed altogether given the above reasoning:

 > we'd like to emphasize the connection between the Customizer and the
 frontend rather than the admin

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32637#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list