2

I have wordpress site and set login page as static front page. If I go to theme customizer exactly it will use front page to show site live preview. How to change page live preview to another page? In this case I will use post page as live preview page in customizer.

1 Answer 1

5

The default URL being previewed is home_url( '/' ). When no url query parameter is present when opening customize.php, this is the preview URL that is used. You can override the previewed URL when there is no url query parameter to supply a different default using something like this:

add_action( 'customize_controls_init', function() {
    global $wp_customize;
    if ( ! isset( $_GET['url'] ) ) {
        $wp_customize->set_preview_url( get_permalink( 1 ) );
    }
} );
5
  • but when I make a change, it goes back to the front page
    – Prast
    Jun 21, 2017 at 3:08
  • @Prast I'm not sure what you mean. Jun 21, 2017 at 15:47
  • when I make a change in customizer, the page preview goes back show the front page, not the preview URL that I have set anymore.
    – Prast
    Jun 22, 2017 at 1:30
  • @Prast not for me. What control are you changing in your test? Jun 22, 2017 at 22:19
  • @WestonRuter he means that after changing options customizer does a full refresh and loads home page even though url points to the custom page. Works fine with partial refresh.
    – Runnick
    Nov 29, 2017 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.