bbp_redirect( string $location = '', int $status = 302 )
Perform a safe, local redirect somewhere inside the current site
Description Description
On some setups, passing the value of wp_get_referer() may result in an empty value for $location, which results in an error on redirection. If $location is empty, we can safely redirect back to the forum root. This might change in a future version, possibly to the site root.
See also See also
Parameters Parameters
- $location
-
(Optional) The URL to redirect the user to.
Default value: ''
- $status
-
(Optional) The numeric code to give in the redirect headers. Default: 302.
Default value: 302
Source Source
File: includes/core/functions.php
function bbp_redirect( $location = '', $status = 302 ) { // Prevent errors from empty $location if ( empty( $location ) ) { $location = bbp_get_forums_url(); } // Setup the safe redirect wp_safe_redirect( $location, $status ); // Exit so the redirect takes place immediately exit(); }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |