bp_blogs_update_blogmeta( int $blog_id, string $meta_key, mixed $meta_value, mixed $prev_value = '' )

Update a piece of blog meta.

Description

Parameters

$blog_id

(int) (Required) ID of the blog whose metadata is being updated.

$meta_key

(string) (Required) Key of the metadata being updated.

$meta_value

(mixed) (Required) Value to be set.

$prev_value

(mixed) (Optional) If specified, only update existing metadata entries with the specified value. Otherwise, update all entries.

Default value: ''

Return

(bool|int) Returns false on failure. On successful update of existing metadata, returns true. On successful creation of new metadata, returns the integer ID of the new metadata row.

Source

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

function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value, $prev_value = '' ) {
	add_filter( 'query', 'bp_filter_metaid_column_name' );
	$retval = update_metadata( 'blog', $blog_id, $meta_key, $meta_value, $prev_value );
	remove_filter( 'query', 'bp_filter_metaid_column_name' );

	return $retval;
}

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.