-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathComment_Meta_Command.php
More file actions
38 lines (35 loc) · 972 Bytes
/
Comment_Meta_Command.php
File metadata and controls
38 lines (35 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* Manage comment custom fields.
*
* ## EXAMPLES
*
* # Set comment meta
* $ wp comment meta set 123 description "Mary is a WordPress developer."
* Success: Updated custom field 'description'.
*
* # Get comment meta
* $ wp comment meta get 123 description
* Mary is a WordPress developer.
*
* # Update comment meta
* $ wp comment meta update 123 description "Mary is an awesome WordPress developer."
* Success: Updated custom field 'description'.
*
* # Delete comment meta
* $ wp comment meta delete 123 description
* Success: Deleted custom field.
*/
class Comment_Meta_Command extends \WP_CLI\CommandWithMeta {
protected $meta_type = 'comment';
/**
* Check that the comment ID exists
*
* @param int
*/
protected function check_object_id( $object_id ) {
$fetcher = new \WP_CLI\Fetchers\Comment;
$comment = $fetcher->get_check( $object_id );
return $comment->comment_ID;
}
}