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
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 ) );
}
} );
-
-
-
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.– PrastCommented Jun 22, 2017 at 1:30
-
@Prast not for me. What control are you changing in your test? Commented 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.– RunnickCommented Nov 29, 2017 at 18:57