bp_get_search_placeholder

Get the placeholder text for the search box for a given component.

Description

(string) bp_get_search_placeholder( (string) $component = '' ); 

Returns (string)

Placeholder text for the search field.

Parameters (1)

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

Usage

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

Defined (1)

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

/bp-core/bp-core-template.php  
  1. function bp_get_search_placeholder( $component = '' ) { 
  2. $query_arg = bp_core_get_component_search_query_arg( $component ); 
  3.  
  4. if ( $query_arg && ! empty( $_REQUEST[ $query_arg ] ) ) { 
  5. $placeholder = wp_unslash( $_REQUEST[ $query_arg ] ); 
  6. } else { 
  7. $placeholder = bp_get_search_default_text( $component ); 
  8.  
  9. return $placeholder;