Last active
August 3, 2018 20:49
-
-
Save mgratch/cf6e58e5d8ce2861762b7408021d1f83 to your computer and use it in GitHub Desktop.
get random images for featured image, using wp-cli, a loop, wget and npm json
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
// get random images for featured image | |
for id in $(wp post list --format=ids); | |
do wp post meta update $id _thumbnail_id \ | |
$(wp media import \ | |
$(wget -O - -q -t 1 http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC | \ | |
json data.images.original.url) --porcelain); \ | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment