Skip to main content

Update

Updates an existing post or category in WordPress with new properties and metadata.

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.
info

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).
  • Object Id - The ID of the object to update (post ID or category ID).
  • Object - An object containing the properties to update.

Options

  • Object - Type of object to update. Required. Options:
    • Post - Update a post
    • Category - Update a category
  • 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

  • Object - The complete updated post or category object returned from WordPress.

How It Works

The Update node modifies an existing WordPress object using the WordPress REST API.

When executed, the node:

  1. Validates the Object type is selected
  2. Validates the Object Id is provided
  3. Validates the Object data is provided
  4. Retrieves the authentication (either from Client Id or direct credentials)
  5. Sends a POST request to /wp-json/wp/v2/{object_type}/{id} endpoint
  6. Returns the updated object with all metadata

Authentication Methods

Connect → Store Client Id → Update (use Client Id)

Method 2: Direct Credentials

Provide both Site URL and Credentials directly in the node options.

Requirements

  • A WordPress site with REST API enabled (WordPress 4.7+)
  • Valid object ID that exists
  • Appropriate user permissions:
    • To update posts: author role or higher (must be post author or editor/admin)
    • To update categories: editor role or higher
  • Object must exist before updating

Updatable Properties

Post Properties

You can update any of these properties:

  • title - Post title
  • content - Post content (HTML supported)
  • excerpt - Post excerpt
  • status - Post status (publish, draft, pending, private, future)
  • author - Author ID
  • featured_media - Featured image ID
  • comment_status - open or closed
  • ping_status - open or closed
  • format - Post format
  • meta - Custom meta fields
  • sticky - Sticky status (boolean)
  • categories - Array of category IDs
  • tags - Array of tag IDs
  • date - Publication date

Category Properties

You can update any of these properties:

  • name - Category name
  • slug - URL-friendly identifier
  • description - Category description
  • parent - Parent category ID

Error Handling

The node will return specific errors in the following cases:

  • Object type not selected
  • Empty or missing Object Id
  • Empty or missing Object data
  • Invalid Object Id (object doesn't exist)
  • Invalid property values
  • Authentication failure
  • Insufficient permissions to update object
  • Duplicate name (for categories)
  • Network connection errors
  • WordPress REST API disabled

Usage Notes

  • Only include properties you want to change - omitted properties remain unchanged
  • You cannot change the object ID
  • Updating a post updates the modified date automatically
  • Status changes are subject to user permissions
  • Categories can be renamed but slug may need manual update
  • All fields are optional - update only what you need
  • Returns the complete updated object

Example: Update Post Title and Content

Inputs:

  • Object Id: 123
  • Object:
{
"title": "Updated Post Title",
"content": "<p>This is the updated content.</p>"
}

Options:

  • Object: Post

Output: The complete post object with updated properties.

Example: Change Post Status

Inputs:

  • Object Id: 123
  • Object:
{
"status": "publish"
}

This publishes a draft post without changing any other properties.

Example: Update Post Categories and Tags

Inputs:

  • Object Id: 123
  • Object:
{
"categories": [5, 12, 18],
"tags": [3, 7, 15, 22]
}

This replaces the current categories and tags with the new ones.

Example: Add Featured Image to Post

Inputs:

  • Object Id: 123
  • Object:
{
"featured_media": 456
}

Sets the featured image using a media ID (get from Create Media or List Media).

Example: Update Category Name and Description

Inputs:

  • Object Id: 5
  • Object:
{
"name": "Technology & Innovation",
"description": "Posts about technology, software, and innovation"
}

Options:

  • Object: Category

Common Use Cases

Post Status Management

  • Publish draft posts
  • Move published posts to draft
  • Archive old posts (set to private)
  • Schedule posts for future publication

Content Updates

  • Update post content
  • Fix typos or errors
  • Add new sections to posts
  • Update outdated information

Metadata Management

  • Change post categories
  • Update tags
  • Set featured images
  • Update custom fields

Category Maintenance

  • Rename categories
  • Update descriptions
  • Change category hierarchy
  • Improve SEO metadata

Bulk Updates

  • Update multiple posts in a loop
  • Standardize metadata across posts
  • Migrate categories
  • Fix formatting issues

Example Workflows

Publish Draft Posts After Review

1. List Posts (Status: Draft)
2. For each post:
- Review post (manual or automated)
- If approved:
Update (Object Id: post.id, Object: {"status": "publish"})

Update Post with Featured Image

1. Create Media (upload image) → Store media.id
2. Update (Object Id: post_id, Object: {"featured_media": media.id})

Move Posts to Different Category

1. List Posts (category: old_category_id)
2. For each post:
- Get current categories
- Remove old_category_id
- Add new_category_id
- Update post with new categories

Bulk Content Update

1. List Posts (filter by criteria)
2. For each post:
- Get post content
- Find and replace text
- Update (Object Id: post.id, Object: {"content": updated_content})

Schedule Posts for Publication

1. List Posts (Status: Draft)
2. For each post:
- Calculate publication date
- Update (Object Id: post.id, Object: {
"status": "future",
"date": calculated_date
})

Processing Update Data

Get Current Values and Update

// After Get node retrieves current post
const post = msg.object;

// Modify specific properties
post.title = "Updated: " + post.title;
post.categories.push(new_category_id);

// Prepare update object
return {
update_data: {
title: post.title,
categories: post.categories
}
};

Conditional Update

const post = msg.object;

// Only update if condition met
if (post.categories.includes(5)) {
return {
update_data: {
tags: [3, 7, 15], // Add tags to tech posts
featured_media: default_image_id
}
};
}

Append to Content

const post = msg.object;
const additional_content = "<p>Updated on " + new Date().toLocaleDateString() + "</p>";

return {
update_data: {
content: post.content.rendered + additional_content
}
};

Best Practices

  • Always verify the object exists before updating (use Get node)
  • Only include properties you want to change
  • Validate data before updating
  • Handle update errors appropriately
  • Keep track of what was updated for auditing
  • Test updates on draft posts first
  • Back up data before bulk updates
  • Use appropriate status transitions
  • Check user permissions before attempting updates
  • Verify category/tag IDs exist before assignment

Incremental vs Complete Updates

{
"title": "New Title"
}

Only changes the title, leaves everything else unchanged.

Multiple Property Update

{
"title": "New Title",
"content": "New content",
"status": "publish"
}

Updates multiple properties at once.

Performance Considerations

  • Update operations are efficient
  • Only changed data is transmitted
  • No need to send complete object
  • Bulk updates should be throttled to avoid API rate limits
  • Consider batching updates with delays
  • WordPress updates modified date automatically

Troubleshooting

Error: "Object should be selected"

  • Select either Post or Category from the Object dropdown
  • The Object option is required

Error: "Object ID cannot be empty"

  • Provide a valid numeric Object Id
  • Verify the ID variable contains a value

Error: "Object cannot be empty"

  • Provide an object with at least one property to update
  • Check the Object input is properly formatted

Error: 404 Not Found

  • The object with that ID doesn't exist
  • Use Get node to verify object exists
  • Check if object was deleted

Error: 403 Forbidden

  • Insufficient permissions to update
  • Check user role and capabilities
  • Authors can only update their own posts
  • Only editors+ can update others' posts

Update succeeds but changes not visible:

  • Check if you're viewing the correct post
  • Clear WordPress cache
  • Refresh the page
  • Verify the update in WordPress admin

Categories not updating:

  • Ensure category IDs are valid
  • Use List Categories to verify IDs
  • Categories must be an array of IDs
  • Check that categories exist

Security Considerations

  • Validate all user input before updating
  • Sanitize content to prevent XSS
  • Verify permissions before bulk updates
  • Log update operations for auditing
  • Handle sensitive data appropriately
  • Use appropriate user roles

Advanced Patterns

Atomic Updates with Get-Update

1. Get (Object Id: post_id) → Store as current_post
2. Modify properties in current_post
3. Update (Object Id: post_id, Object: modified_properties)
4. If error: Retry or rollback

Bulk Update with Error Handling

For each post_id in post_list:
Try:
1. Get (Object Id: post_id)
2. Prepare update data
3. Update (Object Id: post_id, Object: update_data)
4. Log success
Catch:
- Log error
- Continue to next post

Update with Validation

1. Get (Object Id: post_id)
2. Validate current state:
- Check status
- Verify author
- Validate categories
3. If valid:
- Update (Object Id: post_id, Object: new_data)
Else:
- Skip update and log reason

Scheduled Content Update

1. List Posts (Status: Publish)
2. For each post older than 1 year:
- Add "outdated content" warning to content
- Update (Object Id: post.id, Object: {
"content": post.content + warning_html
})

Integration Examples

Sync Updates from External System

1. Get updates from external API
2. For each update:
- Find matching post (by custom field or slug)
- Transform data to WordPress format
- Update (Object Id: post_id, Object: transformed_data)

SEO Optimization Update

1. List Posts
2. For each post:
- Analyze content for SEO
- Generate meta description
- Update (Object Id: post.id, Object: {
"excerpt": generated_description,
"meta": { "seo_score": score }
})

Content Refresh Workflow

1. List Posts (filter by date > 1 year old)
2. For each post:
- Review content relevance
- Update outdated information
- Add "Updated" prefix to title
- Update (Object Id: post.id, Object: refreshed_data)