bp_get_search_placeholder( string $component = '' )

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

Description

Parameters

$component

(Optional) Component name. Defaults to current component.

Default value: ''

Return

(string) Placeholder text for the search field.

Source

File: bp-core/bp-core-template.php

655
656
657
658
659
660
661
662
663
664
665
function bp_get_search_placeholder( $component = '' ) {
    $query_arg = bp_core_get_component_search_query_arg( $component );
 
    if ( $query_arg && ! empty( $_REQUEST[ $query_arg ] ) ) {
        $placeholder = wp_unslash( $_REQUEST[ $query_arg ] );
    } else {
        $placeholder = bp_get_search_default_text( $component );
    }
 
    return $placeholder;
}

Changelog

Changelog
Version Description
BuddyPress 2.7.0 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.