bbp_search_results_redirect

Redirect to search results page if needed.

Description

bbp_search_results_redirect(); 

Usage

  1. if ( !function_exists( 'bbp_search_results_redirect' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/search/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_search_results_redirect(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/search/functions.php  
  1. function bbp_search_results_redirect() { 
  2. global $wp_rewrite; 
  3.  
  4. // Bail if not a search request action 
  5. if ( empty( $_GET['action'] ) || ( 'bbp-search-request' !== $_GET['action'] ) ) { 
  6. return; 
  7.  
  8. // Bail if not using pretty permalinks 
  9. if ( ! $wp_rewrite->using_permalinks() ) { 
  10. return; 
  11.  
  12. // Get the redirect URL 
  13. $redirect_to = bbp_get_search_results_url(); 
  14. if ( empty( $redirect_to ) ) { 
  15. return; 
  16.  
  17. // Redirect and bail 
  18. wp_safe_redirect( $redirect_to ); 
  19. exit();