bp_blogs_add_blogmeta( int $blog_id, string $meta_key, mixed $meta_value, bool $unique = false )

Add a piece of blog metadata.


Parameters Parameters

$blog_id

(int) (Required) ID of the blog.

$meta_key

(string) (Required) Metadata key.

$meta_value

(mixed) (Required) Metadata value.

$unique

(bool) (Optional) Whether to enforce a single metadata value for the given key. If true, and the object already has a value for the key, no change will be made. Default: false.

Default value: false


Top ↑

Return Return

(int|bool) The meta ID on successful update, false on failure.


Source Source

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

function bp_blogs_add_blogmeta( $blog_id, $meta_key, $meta_value, $unique = false ) {
	add_filter( 'query', 'bp_filter_metaid_column_name' );
	add_filter( 'sanitize_key', 'bp_blogs_filter_meta_column_name' );
	$retval = add_metadata( 'bp_blog', $blog_id, $meta_key, $meta_value, $unique );
	remove_filter( 'sanitize_key', 'bp_blogs_filter_meta_column_name' );
	remove_filter( 'query', 'bp_filter_metaid_column_name' );

	return $retval;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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