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

Slurp up metadata for a set of groups.


Description 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 Parameters

$group_ids

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

Default value: false


Top ↑

Source 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 );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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