wp_strict_cross_origin_referrer() WordPress Function

The wp_strict_cross_origin_referrer() function is used to enforce the same-origin policy for cross-origin requests. This policy prevents a malicious site from forcing a user to navigate to a different site by injecting a link into the page that redirects the user to the malicious site.

wp_strict_cross_origin_referrer() #

Displays a referrer strict-origin-when-cross-origin meta tag.


Description

Outputs a referrer strict-origin-when-cross-origin meta tag that tells the browser not to send the full URL as a referrer to other sites when cross-origin assets are loaded.

Typical usage is as a ‘wp_head’ callback:

add_action( 'wp_head', 'wp_strict_cross_origin_referrer' );

Top ↑

Source

File: wp-includes/general-template.php

function wp_strict_cross_origin_referrer() {
	?>
	<meta name='referrer' content='strict-origin-when-cross-origin' />
	<?php
}


Top ↑

Changelog

Changelog
VersionDescription
5.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