Skip to content

Instantly share code, notes, and snippets.

@dgwyer
Last active August 14, 2023 16:30
Show Gist options
  • Save dgwyer/039b0eca77bf526492e318a85fa3284e to your computer and use it in GitHub Desktop.
Save dgwyer/039b0eca77bf526492e318a85fa3284e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Number of posts to create
posts=100
# Paragraphs
p=2
# Create new posts and pages with random Lorem ipsum content inside paragraph blocks
curl -N http://loripsum.net/api/$p | sed '/^$/d' | sed 's/^/<\!-- wp:paragraph -->/' | sed 's/$/<\!-- \/wp:paragraph -->/' | wp post generate --count=$posts --post_content
@dgwyer
Copy link
Author

dgwyer commented Aug 14, 2023

Note that this is 'block friendly'. Which means that not only does it create posts with random sample Lorem Ipsum text, it also adds each paragraph fetched from the Lorem API to a Gutenberg paragraph block.

Otherwise, when you viewed each post the Lorem text is just added to a 'Classic' block which isn't what we want.

Result for each post is something like this.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment