manifest / unclassified / draft-post-creator-plugin
Draft Post Creator
Creates draft posts via a POST request with SEO meta fields and featured image.
★ 0stars
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/abdulsamadshaikh/draft-post-creator-plugin/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
📥 Installation
- Download the plugin
.zipfile. - Go to your WordPress Dashboard → Plugins → Add New → Upload Plugin.
- Upload the
.zipfile and click Install Now. - Activate the plugin.
🚀 Usage
🔗 API Endpoint
POST /wp-json/draft-post-creator/v1/create-post
🛡️ Authentication
- Use Bearer Token authentication.
- Hardcoded Token:
api_token_12345abcde67890
📤 Request Headers
{
"Content-Type": "application/json",
"Authorization": "Bearer api_token_12345abcde67890"
}
📋 Request Payload Example
{
"title": "Sample Draft Post",
"description": "This is the main content of the draft post.",
"meta_title": "SEO Optimized Title",
"meta_keywords": "WordPress, Plugin, API",
"meta_description": "This is a meta description for SEO purposes.",
"img_url": "https://images.pexels.com/photos/30819809/pexels-photo-30819809.jpeg"
}
✅ Success Response
{
"success": "Post created successfully",
"post_id": 123
}
❌ Error Responses
- 401 Unauthorized: Missing or invalid Bearer Token.
- 400 Bad Request: Missing required fields or invalid image URL.
- 500 Internal Server Error: Post creation or image upload failed.
🧪 Testing the API
✅ Using cURL:
curl -X POST https://your-site.com/wp-json/draft-post-creator/v1/create-post \
-H "Content-Type: application/json" \
-H "Authorization: Bearer api_token_12345abcde67890" \
-d '{
"title": "Sample Post",
"description": "Post content here",
"meta_title": "SEO Title",
"meta_keywords": "API, WordPress, Post",
"meta_description": "SEO meta description",
"img_url": "https://images.pexels.com/photos/30819809/pexels-photo-30819809.jpeg"
}'
✅ Using Postman:
- Set the method to POST.
- Add the URL:
https://your-site.com/wp-json/draft-post-creator/v1/create-post - Add Headers:
Content-Type: application/jsonAuthorization: Bearer api_token_12345abcde67890
- In Body → raw → JSON, paste the request payload.
- Click Send and check the response.
💡 Features
- 📝 Creates a draft post with a title, description, and SEO meta fields.
- 🖼️ Downloads and sets a featured image from a provided URL.
- 🔐 Secured with Bearer Token authentication.
💡 Notes
- The post is created in Draft status.
- The following SEO meta fields are saved using WordPress custom fields:
- Meta Title (
meta_title) - Meta Keywords (
meta_keywords) - Meta Description (
meta_description)
- Meta Title (
- The featured image is set using the provided
img_url.
🛡️ Security Tip
For production use, replace the hardcoded token with dynamic JWT or OAuth authentication for enhanced security.