bp_ajax_querystring( string|bool $object = false )

Allow templates to pass parameters directly into the template loops via AJAX.

Description

For the most part this will be filtered in a theme’s functions.php for example in the default theme it is filtered via bp_dtheme_ajax_querystring().

By using this template tag in the templates it will stop them from showing errors if someone copies the templates from the default theme into another WordPress theme without coping the functions from functions.php.

Parameters

$object

(string|bool) (Optional) Current template component.

Default value: false

Return

(string) The AJAX querystring.

Source

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

function bp_ajax_querystring( $object = false ) {
	$bp = buddypress();

	if ( ! isset( $bp->ajax_querystring ) ) {
		$bp->ajax_querystring = '';
	}

	/**
	 * Filters the template paramenters to be used in the query string.
	 *
	 * Allows templates to pass parameters into the template loops via AJAX.
	 *
	 * @since BuddyPress 1.2.0
	 *
	 * @param string $ajax_querystring Current query string.
	 * @param string $object           Current template component.
	 */
	return apply_filters( 'bp_ajax_querystring', $bp->ajax_querystring, $object );
}

Changelog

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