Requests_Response::is_redirect() WordPress Method

The Requests_Response::is_redirect() method is used to check if a response is a redirect or not. This is useful for checking if a response is a redirect before following it.

Requests_Response::is_redirect() #

Is the response a redirect?


Return

(boolean) True if redirect (3xx status), false if not.


Top ↑

Source

File: wp-includes/Requests/Response.php

	public function is_redirect() {
		$code = $this->status_code;
		return in_array($code, array(300, 301, 302, 303, 307), true) || $code > 307 && $code < 400;
	}

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.