Create Post
Creates a new post in WordPress with specified content, title, status, and other properties.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Client Id - The client ID from the Connect node (optional if using direct credentials).
- Post - An object containing the post properties such as title, content, status, categories, tags, and other metadata.
Options
- Site URL - (Optional) WordPress site URL. Use this if you want to authenticate directly without a Connect node.
- Credentials - (Optional) WordPress username and application password. Use this if you want to authenticate directly without a Connect node.
Output
- Result - The complete post object returned from WordPress, including the post ID, date, modified date, link, and all other post properties.
How It Works
The Create Post node creates a new WordPress post using the WordPress REST API.
When executed, the node:
- Retrieves the authentication (either from Client Id or direct credentials)
- Validates the post data
- Sends a POST request to
/wp-json/wp/v2/postsendpoint - Returns the created post object with all metadata
Post Object Properties
The Post input accepts an object with the following properties:
- title - The post title (can be plain text or HTML)
- content - The post content (HTML is supported)
- status - Post status:
publish,draft,pending,private, orfuture - author - Author ID (numeric)
- excerpt - Post excerpt
- featured_media - Featured image ID
- comment_status -
openorclosed - ping_status -
openorclosed - format - Post format:
standard,aside,gallery,link,image,quote,status,video,audio, orchat - meta - Custom meta fields (object)
- sticky - Whether the post should be sticky (boolean)
- categories - Array of category IDs
- tags - Array of tag IDs
- date - Publication date in ISO 8601 format
- date_gmt - Publication date in GMT
Authentication Methods
You can authenticate in two ways:
Method 1: Using Connect Node (Recommended)
Connect → Store Client Id → Create Post (use Client Id)
Method 2: Direct Credentials
Provide both Site URL and Credentials directly in the node options. This is useful for one-off operations but not recommended for multiple operations.
Requirements
- A WordPress site with REST API enabled (WordPress 4.7+)
- Appropriate user permissions to create posts
- For draft posts: contributor level or higher
- For published posts: author level or higher
Error Handling
The node will return specific errors in the following cases:
- Missing or empty Post data
- Invalid post properties
- Authentication failure
- Insufficient permissions to create posts
- Invalid category or tag IDs
- Network connection errors
- WordPress REST API disabled
Usage Notes
- The post content can include HTML markup
- Images can be included using HTML
<img>tags with URLs - To set a featured image, upload it first using Create Media node and use the returned media ID
- Draft posts can be created by any authenticated user with contributor role or higher
- Published posts require author role or higher
- The returned result includes the full post object with WordPress-generated metadata
Example: Create Draft Post
Input - Post:
{
"title": "My New Blog Post",
"content": "<p>This is the content of my blog post.</p>",
"status": "draft"
}
Output - Result: The result will include the complete post object:
{
"id": 123,
"date": "2024-01-15T10:30:00",
"status": "draft",
"title": {
"rendered": "My New Blog Post"
},
"content": {
"rendered": "<p>This is the content of my blog post.</p>"
},
"link": "https://yoursite.com/?p=123"
}
Example: Create Published Post with Categories
Input - Post:
{
"title": "Product Launch Announcement",
"content": "<h2>Introducing Our New Product</h2><p>We're excited to announce...</p>",
"status": "publish",
"categories": [5, 12],
"tags": [3, 7, 15],
"excerpt": "We're launching a new product today!",
"featured_media": 456
}
Example: Scheduled Post
Input - Post:
{
"title": "Scheduled Post for Tomorrow",
"content": "<p>This post will be published tomorrow.</p>",
"status": "future",
"date": "2024-12-25T09:00:00"
}
Common Use Cases
Automated Content Publishing
- Generate posts from data sources (CSV, Excel, databases)
- Create posts from RSS feeds or external APIs
- Bulk content creation and migration
Dynamic Content Creation
- Generate posts based on user input or form submissions
- Create posts from email content
- Automated report publishing
Content Scheduling
- Schedule posts for future publication
- Create draft posts for review
- Batch post creation with different publication dates
Best Practices
- Always set an appropriate status (draft for testing, publish for production)
- Use draft status first to review posts before publishing
- Include meaningful titles and excerpts for better SEO
- Validate your content before creating posts
- Handle errors appropriately to avoid duplicate posts
- Use categories and tags to organize content
- Set featured images for better visual appeal
- Include proper HTML formatting for rich content
- Use scheduled posts (status: future) for time-based publishing
Troubleshooting
Error: "Post cannot be empty"
- Ensure you're passing a valid post object
- At minimum, include a title property
Error: "Insufficient permissions"
- Verify the WordPress user has appropriate role (author or higher for publish)
- Check that the user account is active
Post created but not visible on site:
- Check the post status (draft posts aren't visible to public)
- Verify the categories and visibility settings
- Ensure the post isn't scheduled for future publication
SEO Considerations
- Use descriptive, keyword-rich titles
- Include meta descriptions in the excerpt field
- Add relevant categories and tags
- Use proper heading hierarchy in content (H2, H3, etc.)
- Include alt text for images in the HTML content
- Set featured images for social media sharing