WP_Customize_Manager::filter_iframe_security_headers() WordPress Method

The WP_Customize_Manager::filter_iframe_security_headers() method is used to filter the security headers for iframes in the Customizer. This is necessary to allow iframes to be used in the Customizer for live previews.

WP_Customize_Manager::filter_iframe_security_headers( array $headers ) #

Filters the X-Frame-Options and Content-Security-Policy headers to ensure frontend can load in customizer.


Parameters

$headers

(array)(Required)Headers.


Top ↑

Return

(array) Headers.


Top ↑

Source

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

	public function filter_iframe_security_headers( $headers ) {
		$headers['X-Frame-Options']         = 'SAMEORIGIN';
		$headers['Content-Security-Policy'] = "frame-ancestors 'self'";
		return $headers;
	}

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