Skip to content

Instantly share code, notes, and snippets.

@allysonsouza
Last active April 2, 2024 18:29
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 allysonsouza/cad1d8273ba4ca0a167ee40d3f195640 to your computer and use it in GitHub Desktop.
Save allysonsouza/cad1d8273ba4ca0a167ee40d3f195640 to your computer and use it in GitHub Desktop.
[WP-CLI Commands] Useful WP-CLI commands and "recipes" #wpcli #wordpress

Multisite Search and Replace

wp config set DOMAIN_CURRENT_SITE "newdomain.com"
wp search-replace "olddomain.com" "newdomain.com" --url=newdomain --precise
wp search-replace --network "http://olddomain.com" "https://newdomain.com" --precise --all-tables

Add Super Admin

wp user create username user@domain.com --role=administrator
wp super-admin add username

WooCommerce - Delete all products

wp post delete $(wp post list --post_status=trash --post_type='product' --format=ids --posts_per_page=10000) --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment