Skip to content

Instantly share code, notes, and snippets.

@rcg4u
Forked from jplhomer/disable-comments.sh
Created November 16, 2020 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcg4u/545cf0a7ed10d0cf8357a4a6c5150c98 to your computer and use it in GitHub Desktop.
Save rcg4u/545cf0a7ed10d0cf8357a4a6c5150c98 to your computer and use it in GitHub Desktop.
Disable all comments/pings in WordPress with WP-CLI
$ wp post list --format=ids | xargs wp post update --comment_status=closed
# Output:
# Success: Updated post 2514.
# Success: Updated post 2511.
# Success: Updated post 2504.
# Success: Updated post 2499.
# Success: Updated post 2441.
# etc...
$ wp post list --format=ids | xargs wp post update --ping_status=closed
# Output:
# Success: Updated post 2514.
# Success: Updated post 2511.
# Success: Updated post 2504.
# Success: Updated post 2499.
# Success: Updated post 2441.
# etc...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment