bp_core_get_component_search_query_arg( string|null $component = null )

Get the ‘search’ query argument for a given component.


Parameters Parameters

$component

(string|null) (Optional) Component name. Defaults to current component.

Default value: null


Top ↑

Return Return

(string|bool) Query argument on success. False on failure.


Source Source

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

function bp_core_get_component_search_query_arg( $component = null ) {
	if ( ! $component ) {
		$component = bp_current_component();
	}

	$query_arg = false;
	if ( isset( buddypress()->{$component}->search_query_arg ) ) {
		$query_arg = sanitize_title( buddypress()->{$component}->search_query_arg );
	}

	/**
	 * Filters the query arg for a component search string.
	 *
	 * @since 2.4.0
	 *
	 * @param string $query_arg Query argument.
	 * @param string $component Component name.
	 */
	return apply_filters( 'bp_core_get_component_search_query_arg', $query_arg, $component );
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 The $component parameter was made optional, with the current component as the fallback value.
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.