bbp_get_search_results_url

Return the search url.

Description

(string) bbp_get_search_results_url(); 

Returns (string)

Search url


Usage

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

Defined (1)

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

/includes/search/template.php  
  1. function bbp_get_search_results_url() { 
  2. global $wp_rewrite; 
  3.  
  4. // Get the search terms 
  5. $search_terms = bbp_get_search_terms(); 
  6.  
  7. // Pretty permalinks 
  8. if ( $wp_rewrite->using_permalinks() ) { 
  9.  
  10. // Root search URL 
  11. $url = $wp_rewrite->root . bbp_get_search_slug(); 
  12.  
  13. // Append search terms 
  14. if ( !empty( $search_terms ) ) { 
  15. $url = trailingslashit( $url ) . user_trailingslashit( urlencode( $search_terms ) ); 
  16.  
  17. // Run through home_url() 
  18. $url = home_url( user_trailingslashit( $url ) ); 
  19.  
  20. // Unpretty permalinks 
  21. } else { 
  22. $url = add_query_arg( array( bbp_get_search_rewrite_id() => urlencode( $search_terms ) ), home_url( '/' ) ); 
  23.  
  24. return apply_filters( 'bbp_get_search_results_url', $url );