bbp_search_results_redirect()
Redirect to search results page if needed
Description
Return
(If) a redirect is not needed
Source
File: bp-forums/search/functions.php
function bbp_search_results_redirect() {
global $wp_rewrite;
// Bail if not a search request action
if ( empty( $_GET['action'] ) || ( 'bbp-search-request' !== $_GET['action'] ) ) {
return;
}
// Bail if not using pretty permalinks
if ( ! $wp_rewrite->using_permalinks() ) {
return;
}
// Get the redirect URL
$redirect_to = bbp_get_search_results_url();
if ( empty( $redirect_to ) ) {
return;
}
// Redirect and bail
wp_safe_redirect( $redirect_to );
exit();
}
Changelog
| Version | Description |
|---|---|
| bbPress (r4928) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.