Created
June 1, 2017 01:45
-
-
Save davemac/a7eae8dfeff38c74cbcdcb239cb41e8d to your computer and use it in GitHub Desktop.
wp-cli bash script to create posts from files
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
https://wordpress.stackexchange.com/a/224482/131 | |
#!/bin/bash | |
FILES=*.txt | |
for f in $FILES | |
do | |
echo "Processing $f file..." | |
# TEXTFILE = $f | |
# take action on each file. $f store current file name | |
# cat $TEXTFILE | |
wp post create "$f" --post_category=3 --post_title="$f" --user=3 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment