wp_redirect WordPress Filter Hook

The wp_redirect hook allows you to redirect a user to a different URL than the one they were originally trying to access. This can be useful for a number of different things, such as redirecting a user to a login page if they are not logged in, or redirecting a user to a different page if they do not have access to the one they were trying to view.

apply_filters( 'wp_redirect', string $location, int $status ) #

Filters the redirect location.


Parameters

$location

(string)The path or URL to redirect to.

$status

(int)The HTTP response status code to use.


Top ↑

Source

File: wp-includes/pluggable.php

View on Trac



Top ↑

Changelog

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