Skip to content

Commit

Permalink
Add examples on listing unapproved, spam and trash comments (#436)
Browse files Browse the repository at this point in the history
* Add examples on listing unapproved, spam and trash comments

* Update README too

---------

Co-authored-by: Daniel Bachhuber <[email protected]>
  • Loading branch information
pekkakortelainen and danielbachhuber authored Nov 10, 2023
1 parent cb7fe53 commit 0cd4840
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,32 @@ These fields are optionally available:
| 29 | 2013-03-14 11:56:08 | Jane Doe |
+------------+---------------------+----------------+

# List unapproved comments.
$ wp comment list --number=3 --status=hold --fields=ID,comment_date,comment_author
+------------+---------------------+----------------+
| comment_ID | comment_date | comment_author |
+------------+---------------------+----------------+
| 8 | 2023-11-10 13:13:06 | John Doe |
| 7 | 2023-11-10 13:09:55 | Mr WordPress |
| 9 | 2023-11-10 11:22:31 | Jane Doe |
+------------+---------------------+----------------+

# List comments marked as spam.
$ wp comment list --status=spam --fields=ID,comment_date,comment_author
+------------+---------------------+----------------+
| comment_ID | comment_date | comment_author |
+------------+---------------------+----------------+
| 2 | 2023-11-10 11:22:31 | Jane Doe |
+------------+---------------------+----------------+

# List comments in trash.
$ wp comment list --status=trash --fields=ID,comment_date,comment_author
+------------+---------------------+----------------+
| comment_ID | comment_date | comment_author |
+------------+---------------------+----------------+
| 3 | 2023-11-10 11:22:31 | John Doe |
+------------+---------------------+----------------+



### wp comment meta
Expand Down
26 changes: 26 additions & 0 deletions src/Comment_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,32 @@ public function get( $args, $assoc_args ) {
* | 29 | 2013-03-14 11:56:08 | Jane Doe |
* +------------+---------------------+----------------+
*
* # List unapproved comments.
* $ wp comment list --number=3 --status=hold --fields=ID,comment_date,comment_author
* +------------+---------------------+----------------+
* | comment_ID | comment_date | comment_author |
* +------------+---------------------+----------------+
* | 8 | 2023-11-10 13:13:06 | John Doe |
* | 7 | 2023-11-10 13:09:55 | Mr WordPress |
* | 9 | 2023-11-10 11:22:31 | Jane Doe |
* +------------+---------------------+----------------+
*
* # List comments marked as spam.
* $ wp comment list --status=spam --fields=ID,comment_date,comment_author
* +------------+---------------------+----------------+
* | comment_ID | comment_date | comment_author |
* +------------+---------------------+----------------+
* | 2 | 2023-11-10 11:22:31 | Jane Doe |
* +------------+---------------------+----------------+
*
* # List comments in trash.
* $ wp comment list --status=trash --fields=ID,comment_date,comment_author
* +------------+---------------------+----------------+
* | comment_ID | comment_date | comment_author |
* +------------+---------------------+----------------+
* | 3 | 2023-11-10 11:22:31 | John Doe |
* +------------+---------------------+----------------+
*
* @subcommand list
*/
public function list_( $args, $assoc_args ) {
Expand Down

0 comments on commit 0cd4840

Please sign in to comment.