llms_delete_user_postmeta( int $user_id, int $post_id, string $meta_key = null, mixed $meta_value = null )
Delete user postmeta data.
Parameters Parameters
- $user_id
-
(int) (Required) WP User ID.
- $post_id
-
(int) (Required) WP Post ID.
- $meta_key
-
(string) (Optional) Meta key for lookup, if not supplied, all matching items will be removed.
Default value: null
- $meta_value
-
(mixed) (Optional) Meta value for lookup, if not supplied, all matching items will be removed.
Default value: null
Return Return
(bool) False if no postmetas has been deleted either because they do not exist or because of an error during the actual row deletion from the db. True if at least one existing user postmeta has been successfully deleted.
Source Source
File: includes/functions/llms.functions.user.postmeta.php
function llms_delete_user_postmeta( $user_id, $post_id, $meta_key = null, $meta_value = null ) { $ret = false; $existing = _llms_query_user_postmeta( $user_id, $post_id, $meta_key, maybe_unserialize( $meta_value ) ); if ( $existing ) { foreach ( $existing as $obj ) { $item = new LLMS_User_Postmeta( $obj->meta_id, false ); if ( ! $item->delete() ) { $ret = $ret || false; } else { $ret = true; } } } return $ret; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.33.0 | Returns true only if at least one existing user postmeta has been successfully deleted. |
3.21.0 | Introduced. |