Posts of a Type
To list all posts of the snippet
post type in WordPress using WP-CLI, run:
shCopyEditwp post list --post_type=snippet --format=table
✅ This will display:
- Post ID
- Post Title
- Post Status (published, draft, etc.)
- Post Date
🔥 Want Only Published Snippets?
shCopyEditwp post list --post_type=snippet --post_status=publish --format=table
🔥 Want to See Content Too?
shCopyEditwp post list --post_type=snippet --fields=ID,post_title,post_content --format=table
This will show the actual commands stored inside your snippet posts.
🚀 Want to Delete All Snippet Posts?
shCopyEditwp post delete $(wp post list --post_type=snippet --format=ids) --force
⚠ This will delete all snippets permanently! Only run this if you want a fresh start.