bp_groups_update_meta_cache( int|string|array|bool $group_ids = false )

Slurp up metadata for a set of groups.

Description

This function is called in two places in the BP_Groups_Group class:

  • in the populate() method, when single group objects are populated
  • in the get() method, when multiple groups are queried

It grabs all groupmeta associated with all of the groups passed in $group_ids and adds it to WP cache. This improves efficiency when using groupmeta within a loop context.

Parameters

$group_ids

(Optional) Accepts a single group_id, or a comma-separated list or array of group ids.

Default value: false

Source

File: bp-groups/bp-groups-cache.php

function bp_groups_update_meta_cache( $group_ids = false ) {
	$bp = buddypress();

	$cache_args = array(
		'object_ids' 	   => $group_ids,
		'object_type' 	   => $bp->groups->id,
		'cache_group'      => 'group_meta',
		'object_column'    => 'group_id',
		'meta_table' 	   => $bp->groups->table_name_groupmeta,
		'cache_key_prefix' => 'bp_groups_groupmeta'
	);

	bp_update_meta_cache( $cache_args );
}

Changelog

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