bp_core_redirect
Perform a status-safe wp_redirect() that is compatible with BP's URI parser.
Description
Parameters (2)
- 0. $location — Optional. (string) =>
''
- The redirect URL.
- 1. $status — Optional. (int) =>
302
- The numeric code to give in the redirect headers. Default: 302.
Usage
if ( !function_exists( 'bp_core_redirect' ) ) { require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-functions.php'; } // The redirect URL. $location = ''; // Optional. The numeric code to give in the redirect // headers. Default: 302. $status = 302; // NOTICE! Understand what this does before running. $result = bp_core_redirect($location, $status);
Defined (1)
The function is defined in the following location(s).
- /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 );
- die;
- }