WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 4 months ago

#30905 assigned defect (bug)

Theme Preview - Not working preview when front page setting

Reported by: gqevu6bsiz Owned by: stevenkword
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: Canonical Keywords:
Focuses: Cc:
PR Number:

Description

I'm sorry if there are already ticket for same problem.
Preview is not working well (not live preview/customizer).
Is this a bug? or specification?

Steps to reproduce:

  1. Settings to Front page(anyting page) and select the A static page of Front page displays of Reading of Settings.
  2. Access the Themes screen of Appearance with Editor(Editor already have capability to switch_themes).
  3. Click to the preview button of per not activated themes.

Tested in: Google Chrome 39.0.2171.95 m

And I think this happen is affect to following.

wp-includes/canonical.php line 48 - 54

Theme preview is not have post ID. But that it become to have post ID after the Front page settings.

And I have tentatively avoiding the problem in this way.

function test_redirect_canonical( $redirect_url , $requested_url ) {
    if( get_query_var( 'preview' ) && !empty( $_GET['template'] ) && !empty( $_GET['stylesheet'] ) && !empty( $_GET['preview_iframe'] ) ) {
        if( current_user_can( 'switch_themes' ) ) {
            $redirect_url = false;
        }
    }
    return $redirect_url;
}
add_filter( 'redirect_canonical' , 'test_redirect_canonical' , 10 , 2 );

Change History (2)

This ticket was mentioned in Slack in #core by jorbin. View the logs.


4 years ago

#2 @jorbin
4 years ago

  • Owner set to stevenkword
  • Status changed from new to assigned

This looks like to be capabilities related.

Steven has agreed to look into it.

Note: See TracTickets for help on using tickets.