bp_core_redirect( string $location = '', int $status = 302 )
Perform a status-safe wp_redirect() that is compatible with BP’s URI parser.
Description Description
Parameters Parameters
- $location
-
(Optional) The redirect URL.
Default value: ''
- $status
-
(Optional) The numeric code to give in the redirect headers. Default: 302.
Default value: 302
Source Source
File: bp-core/bp-core-functions.php
function bp_core_redirect( $location = '', $status = 302 ) { // On some setups, passing the value of wp_get_referer() may result in an // empty value for $location, which results in an error. Ensure that we // have a valid URL. if ( empty( $location ) ) { $location = bp_get_root_domain(); } // Make sure we don't call status_header() in bp_core_do_catch_uri() as this // conflicts with wp_redirect() and wp_safe_redirect(). buddypress()->no_status_set = true; wp_safe_redirect( $location, $status ); // If PHPUnit is running, do not kill execution. if ( ! defined( 'BP_TESTS_DIR' ) ) { die; } }
Changelog Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |