Skip to content

Instantly share code, notes, and snippets.

@davemac
Created June 1, 2017 01:45
Show Gist options
  • Save davemac/a7eae8dfeff38c74cbcdcb239cb41e8d to your computer and use it in GitHub Desktop.
Save davemac/a7eae8dfeff38c74cbcdcb239cb41e8d to your computer and use it in GitHub Desktop.
wp-cli bash script to create posts from files
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