Les commandes WP CLI pour les commentaires.

Tous les snippets pour gérer les commentaires présents sur vos posts (articles, pages…) dans WordPress grâce aux commandes CLI.

Retirer un commentaire dans la corbeille

BASH
                    # wp comment untrash {comment_ID}
wp comment untrash 1337
                

Mettre un commentaire dans la corbeille

BASH
                    # wp comment trash {comment_ID}
wp comment trash 1337
                

Obtenir le status d’un commentaire

BASH
                    # wp comment status {comment_ID}
wp comment status 123
                

Ne plus définir un commentaire comme SPAM

BASH
                    # wp comment unspam {comment_ID}
wp comment unspam 123
                

Définir un commentaire comme SPAM

BASH
                    # wp comment spam {comment_ID}
wp comment spam 1337
                

Recompter les commentaires d’un post

BASH
                    # wp comment recount {comment_ID}
wp comment recount 1337
                

Gérer les metas d’un commentaire

BASH
                    # Ajouter une meta à un commentaire
# wp comment meta set {comment_ID} {meta_key} {meta_value}
wp comment meta set 1337 description "Nicolas est un développeur WordPress."

# Obtenir la meta d'un commentaire
# wp comment meta get {comment_ID} {meta_key}
wp comment meta get 1337 description

# Mettre à jour la meta d'un commentaire
# wp comment meta update {comment_ID} {meta_key} {meta_value}
wp comment meta update 1337 description "Nicolas est un super développeur WordPress."

# Supprimer la meta d'un commentaire
# wp comment meta delete {comment_ID} {meta_key}
wp comment meta delete 1337 description

# Lister les metas d'un commentaire
# wp comment meta list {comment_ID}
wp comment meta list 1337
                

Générer des commentaires

BASH
                    # wp comment generate --count={comments_count} --post_id={post_id}
wp comment generate --count=42 --post_id=1337
                

Vérifier si un commentaire existe

BASH
                    # wp comment exists {comment_ID}
wp comment exists 1337
                

Obtenir le nombre de commentaires de tout le site

BASH
                    # wp comment count
wp comment count
                

Obtenir le nombre de commentaires d’un post

PHP
                    # wp comment count {post_ID}
wp comment count 1337
                

Désapprouver un commentaire

BASH
                    # wp comment unapprove {comment_ID}
wp comment unapprove 1337
                

Approuver un commentaire

BASH
                    # wp comment approve {comment_ID}
wp comment approve 1337
                

Supprimer un commentaire

BASH
                    # wp comment delete {comment_ID}
wp comment delete 1337
                

Modifier un commentaire existant

BASH
                    # wp comment update {comment_ID} --comment_author={comment_author}
wp comment update 1337 --comment_content='Great article'
                

Lister les commentaires

BASH
                    # wp comment list
wp comment list
                

Obtenir un commentaire

BASH
                    # wp comment get comment_ID
wp comment get 1337
                

Ajouter un commentaire sur un post

BASH
                    # wp comment create --comment_post_ID={post_ID} --comment_content={comment_content} --comment_author={comment_author}
wp comment create --comment_post_ID=1337 --comment_content="hello blog" --comment_author="wp-cli"