Skip to content

Instantly share code, notes, and snippets.

@trepmal
Created August 17, 2015 19:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trepmal/0c4aeaec7d730b248dd6 to your computer and use it in GitHub Desktop.
Save trepmal/0c4aeaec7d730b248dd6 to your computer and use it in GitHub Desktop.
# generating a list of 50 post permalinks
for pid in $(wp post list --field=ID --posts_per_page=50); do wp eval "echo get_the_permalink( $pid ).\"\n\"; "; done > url.txt
# posts and pages
for pid in $(wp post list --field=ID --posts_per_page=50 --post_type=post,page); do wp eval "echo get_the_permalink( $pid ).\"\n\"; "; done > url.txt
# random sample
for pid in $(wp post list --field=ID --posts_per_page=50 --post_type=post,page --orderby=rand); do wp eval "echo get_the_permalink( $pid ).\"\n\"; "; done > url.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment