WP_Http::validate_redirects() WordPress Method

The WP_Http::validate_redirects() method is used to validate whether a given URL is a valid redirect. This is useful for ensuring that a given URL is safe to redirect to, and can help to prevent malicious redirects.

WP_Http::validate_redirects( string $location ) #

Validate redirected URLs.


Parameters

$location

(string)(Required)URL to redirect to.


Top ↑

Source

File: wp-includes/class-wp-http.php

	public static function validate_redirects( $location ) {
		if ( ! wp_http_validate_url( $location ) ) {
			throw new Requests_Exception( __( 'A valid URL was not provided.' ), 'wp_http.redirect_failed_validation' );
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.5Introduced.

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.