bp_get_search_input_name( string $component = '' )

Get the ‘name’ attribute for the search form input element.

Description

Parameters

$component

(Optional) Component name. Defaults to current component.

Default value: ''

Return

(string) Text for the 'name' attribute.

Source

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

function bp_get_search_input_name( $component = '' ) {
	if ( ! $component ) {
		$component = bp_current_component();
	}

	$bp = buddypress();

	$name = '';
	if ( isset( $bp->{$component}->id ) ) {
		$name = $bp->{$component}->id . '_search';
	}

	return $name;
}

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.