Skip to content

Instantly share code, notes, and snippets.

@mgratch
Created August 3, 2018 16:03
Show Gist options
  • Save mgratch/c241c54df23a5d6ca294a83b15e2a5ec to your computer and use it in GitHub Desktop.
Save mgratch/c241c54df23a5d6ca294a83b15e2a5ec to your computer and use it in GitHub Desktop.
Clear my site and load it with randomly generated content, then restore my site!
//backup site and create a new one with dummy posts
wp db export ../backups/now/sql/marcgratch.sql; \
wp db drop; \
mv * ../backups/now/files/; \
wp core download; \
wp config create --prompt; \
wp db create --prompt; \
wp core install --url=marcgratch.test --title=marcgratch.com --admin_user=admin [email protected]; \
curl http://loripsum.net/api/5 | \
wp post generate --post_content --count=25 --format=ids | \
xargs -d ' ' -I % wp post meta add % _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);
// reset to marcgratch.com
wp db drop; \
rm * -rf;
mv ../backups/now/files/* ./; \
wp db create --prompt; \
pv ../backups/now/sql/marcgratch.sql | mysql -uwp -pwp marcgratch;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment