WP_Customize_Manager::set_preview_url()publicWP 4.4.0

Sets the initial URL to be previewed.

URL is validated.

Method of the class: WP_Customize_Manager{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Customize_Manager = new WP_Customize_Manager();
$WP_Customize_Manager->set_preview_url( $preview_url );
$preview_url(string) (required)
URL to be previewed.

Changelog

Since 4.4.0 Introduced.

WP_Customize_Manager::set_preview_url() code WP 6.5.2

public function set_preview_url( $preview_url ) {
	$preview_url       = sanitize_url( $preview_url );
	$this->preview_url = wp_validate_redirect( $preview_url, home_url( '/' ) );
}