wp-rest-cli
v1.3.0
Published
WordPress REST API CLI tool - manage posts, pages, media, categories, and tags from the command line
Downloads
245
Maintainers
Readme
wp-rest-cli
WordPress REST API CLI tool — manage posts, pages, media, categories, and tags from the command line.
Install
npm install -g wp-rest-cliSetup
Configure a WordPress site profile. Authentication uses Application Passwords.
# Add a profile (you'll be prompted for the application password)
wp-rest config add myblog --url https://your-site.com --user your-username
# List profiles
wp-rest config list
# Switch default profile
wp-rest config use myblogUsage
# Posts
wp-rest post list
wp-rest post get <id>
wp-rest post create --title "Hello" --content "World"
wp-rest post update <id> --title "Updated"
wp-rest post delete <id>
# Pages
wp-rest page list
wp-rest page get <id>
wp-rest page create --title "About" --content "About us"
# Media
wp-rest media list
wp-rest media upload <file>
# Categories
wp-rest category list
wp-rest category create --name "Tech"
# Tags
wp-rest tag list
wp-rest tag create --name "javascript"Use --profile <name> to target a non-default profile, and --format json to get machine-readable output.
Requirements
- Node.js >= 18.0.0
- WordPress site with REST API enabled
- WordPress Application Password for the user account
License
MIT
