bp_core_get_component_search_query_arg

Get the 'search' query argument for a given component.

Description

(string|bool) bp_core_get_component_search_query_arg( (null) $component = null ); 

Returns (string|bool)

Query argument on success. False on failure.

Parameters (1)

0. $component — Optional. (null) => null
Component name. Defaults to current component.

Usage

  1. if ( !function_exists( 'bp_core_get_component_search_query_arg' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-functions.php'; 
  3.  
  4. // Optional. Component name. Defaults to current component. 
  5. $component = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_get_component_search_query_arg($component); 
  9.  

Defined (1)

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

/bp-core/bp-core-functions.php  
  1. function bp_core_get_component_search_query_arg( $component = null ) { 
  2. if ( ! $component ) { 
  3. $component = bp_current_component(); 
  4.  
  5. $query_arg = false; 
  6. if ( isset(buddypress)->{$component}->search_query_arg ) ) { 
  7. $query_arg = sanitize_title(buddypress)->{$component}->search_query_arg ); 
  8.  
  9. /** 
  10. * Filters the query arg for a component search string. 
  11. * @since 2.4.0 
  12. * @param string $query_arg Query argument. 
  13. * @param string $component Component name. 
  14. */ 
  15. return apply_filters( 'bp_core_get_component_search_query_arg', $query_arg, $component );