This guide will walk you through setting up WordPress Claude Code Tools for your blog.
- Python 3.8 or higher
- WordPress site (self-hosted or WordPress.com Business plan)
- WordPress admin access
The REST API is enabled by default in WordPress 4.7+. To verify:
- Visit:
https://your-site.com/wp-json/ - You should see JSON data about your site
If you see a 404 error, check your permalinks settings in WordPress admin.
Application passwords provide a secure way to authenticate with the REST API without using your main password.
- Go to WordPress Admin → Users → Your Profile
- Scroll to "Application Passwords" section
- Enter a name (e.g., "Claude Code Tools")
- Click "Add New Application Password"
- Important: Copy the generated password immediately (it won't be shown again)
Install the Application Passwords plugin first.
# Clone the repository
git clone https://github.com/alanops/wordpress-claude-code-tools.git
cd wordpress-claude-code-tools
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtcp examples/config.example.json config.jsonEdit config.json:
{
"site_url": "https://your-wordpress-site.com",
"username": "your-username",
"app_password": "xxxx xxxx xxxx xxxx xxxx xxxx"
}export WP_SITE_URL="https://your-wordpress-site.com"
export WP_USERNAME="your-username"
export WP_APP_PASSWORD="xxxx xxxx xxxx xxxx xxxx xxxx"Add to your .bashrc or .zshrc to persist.
# Test the connection
python scripts/wordpress_publisher.pyYou should see:
✅ Connected to WordPress successfully!
# Run the example
python examples/publish_article.py- Verify your username is correct (use email if that's how you log in)
- Check that the application password is copied correctly (including spaces)
- Ensure your user has publishing permissions
- Check permalink settings (Settings → Permalinks)
- Try saving permalinks again (just click Save Changes)
- Verify
.htaccessfile exists and is writable
If you're testing with a local/development site:
# In your script, add:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# When making requests:
response = requests.post(url, verify=False)Note: Never disable SSL verification in production!
- Check if your hosting provider limits API requests
- Some hosts block external API access on cheaper plans
- Try increasing the timeout value in the scripts
-
Never commit credentials
- Add
config.jsonto.gitignore - Use environment variables in production
- Add
-
Use HTTPS
- Always use
https://URLs - Enable SSL on your WordPress site
- Always use
-
Limit permissions
- Create a dedicated user for API access
- Give minimum required permissions
-
Rotate passwords
- Regularly update application passwords
- Delete unused application passwords
- Read the API Guide for advanced usage
- Check out more examples
- Learn about Claude Code integration