Skip to content

Instantly share code, notes, and snippets.

@joraff
Forked from jplhomer/disable-comments.sh
Last active September 26, 2016 14:57
Show Gist options
  • Save joraff/0197ab45f1aeef44a1808b793ebba6db to your computer and use it in GitHub Desktop.
Save joraff/0197ab45f1aeef44a1808b793ebba6db to your computer and use it in GitHub Desktop.
Disable all comments/pings in WordPress with WP-CLI
$ export SITE="mysite.com"
$ wp post list --format=ids --url=$SITE | xargs wp post update --comment_status=closed --ping_status=closed --url=$SITE
$ wp post list --format=ids --post_type=page --url=$SITE | xargs wp post update --comment_status=closed --ping_status=closed --url=$SITE
# 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