Last active
February 18, 2019 23:40
-
-
Save allysonsouza/f84e6301ee1457025facbeda7c8fd085 to your computer and use it in GitHub Desktop.
WP-CLI Tricks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Output posts into post.txt file, only ID | |
| wp post list --post_type=shop_order --field=ID --format=table > posts.txt | |
| ## Loop trough each post ID stored in posts.txt then run some wp-cli command, like post meta update | |
| ## Change the two %p for %%p if you want to run it in a .bat file (I run it directly on cmd) | |
| FOR /F "tokens=1* delims=" %p IN (posts.txt) DO wp post meta update %p my_meta_key "My Value" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment