I want delete a single post using wp cli in the command line. There was some issue on one article, where my hosting disabled networking & now want me to remove the article using the console.

I don't know how to do it. Please provide with exact command as in how to locate and delete that post.

  • 1
    Is this 123 posts ID or post title? Also, how to reach to the post folder or we have to put it directly after successful login with root password
    – Vabbie
    Commented Jul 1, 2019 at 7:23

1 Answer 1


Please read the docs. It's wp post delete POST-ID.

# Delete post skipping trash
$ wp post delete 123 --force
Success: Deleted post 123.

# Delete all pages
$ wp post delete $(wp post list --post_type='page' --format=ids)
Success: Trashed post 1164.
Success: Trashed post 1186.

# Delete all posts in the trash
$ wp post delete $(wp post list --post_status=trash --format=ids)
Success: Deleted post 1268.
Success: Deleted post 1294.

To get posts by title or meta value use wp post list and pass the output to wp post delete like shown above.

Get posts by title or meta value:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.