WP_Customize_Manager::is_cross_domain() WordPress Method

The WP_Customize_Manager::is_cross_domain() method is used to check if the current customizer request is for a cross-domain site. This is useful for ensuring that the correct URL is used for resources when making Ajax requests.

WP_Customize_Manager::is_cross_domain() #

Determines whether the admin and the frontend are on different domains.


Return

(bool) Whether cross-domain.


Top ↑

Source

File: wp-includes/class-wp-customize-manager.php

	public function is_cross_domain() {
		$admin_origin = wp_parse_url( admin_url() );
		$home_origin  = wp_parse_url( home_url() );
		$cross_domain = ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) );
		return $cross_domain;
	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More