bp_blogs_add_blogmeta( int $blog_id, string $meta_key, mixed $meta_value, bool $unique = false )
Add a piece of blog metadata.
Description
Parameters
- $blog_id
-
(Required) ID of the blog.
- $meta_key
-
(Required) Metadata key.
- $meta_value
-
(Required) Metadata value.
- $unique
-
(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
Return
(int|bool) The meta ID on successful update, false on failure.
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' ); $retval = add_metadata( 'blog', $blog_id, $meta_key, $meta_value, $unique ); remove_filter( 'query', 'bp_filter_metaid_column_name' ); return $retval; }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.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.