llms_bulk_update_user_postmeta( int $user_id, int $post_id, array $data = array(), bool $unique = true )
Update bulk update user postmeta data.
Parameters Parameters
- $user_id
-
(int) (Required) WP User ID.
- $post_id
-
(int) (Required) WP Post ID.
- $data
-
(array) (Optional) Associative array of meta keys => meta values to update.
Default value: array()
- $unique
-
(bool) (Optional) If true, updates existing value (if it exists). If false, will add a new record (allowing multiple records with the same key to exist). Deafult true.
Default value: true
Return Return
(array|true) On error returns an associative array of the submitted keys, each item will be true for success or false for error. On success returns true.
Source Source
File: includes/functions/llms.functions.user.postmeta.php
function llms_bulk_update_user_postmeta( $user_id, $post_id, $data = array(), $unique = true ) { $res = array_fill_keys( array_keys( $data ), null ); $err = false; foreach ( $data as $key => $val ) { $update = llms_update_user_postmeta( $user_id, $post_id, $key, $val, $unique ); $res[ $key ] = $update; if ( ! $update ) { $err = true; } } return $err ? $res : true; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.21.0 | Introduced. |