Skip to main content

Get

Retrieves a single post or category from WordPress by its ID, returning the complete object with all 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 retrieve (post ID or category ID).

Options

  • Object - Type of object to retrieve. Required. Options:
    • Post - Retrieve a post
    • Category - Retrieve 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 post or category object with all properties and metadata.

How It Works

The Get node retrieves a specific WordPress object by ID using the WordPress REST API.

When executed, the node:

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

Authentication Methods

Connect → Store Client Id → Get (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
  • Appropriate permissions:
    • Published posts can be viewed by anyone
    • Draft, pending, and private posts require authentication
    • Categories are publicly accessible

Object Types

Post Object Structure

When retrieving a post, the returned object contains:

  • id - Post ID
  • date - Publication date
  • date_gmt - Publication date in GMT
  • modified - Last modified date
  • slug - Post slug (URL-friendly name)
  • status - Post status (publish, draft, pending, private, future)
  • type - Post type (usually "post")
  • link - Public URL to the post
  • title - Post title object with rendered HTML
  • content - Post content object with rendered HTML
  • excerpt - Post excerpt object with rendered HTML
  • author - Author ID
  • featured_media - Featured image ID
  • comment_status - Comment status (open/closed)
  • ping_status - Ping status (open/closed)
  • sticky - Whether post is sticky
  • template - Template filename
  • format - Post format
  • meta - Custom meta fields
  • categories - Array of category IDs
  • tags - Array of tag IDs

Category Object Structure

When retrieving a category, the returned object contains:

  • id - Category ID
  • count - Number of posts in the category
  • description - Category description
  • link - Public URL to category archive
  • name - Category display name
  • slug - URL-friendly identifier
  • taxonomy - Always "category"
  • parent - Parent category ID (0 for top-level)
  • meta - Custom meta fields

Error Handling

The node will return specific errors in the following cases:

  • Object type not selected
  • Empty or missing Object Id
  • Invalid Object Id (object doesn't exist)
  • Authentication failure (for non-public content)
  • Network connection errors
  • WordPress REST API disabled
  • Insufficient permissions to view the object

Usage Notes

  • Object Id must be a numeric ID
  • Published posts can be retrieved without authentication
  • Draft and private posts require authentication
  • Categories are always publicly accessible
  • The Object option is required - you must select Post or Category
  • Returns complete object data in a single API call
  • More efficient than listing all objects and filtering

Example: Get Post by ID

Inputs:

  • Object Id: 123

Options:

  • Object: Post

Output - Object:

{
"id": 123,
"date": "2024-01-15T10:30:00",
"status": "publish",
"slug": "my-blog-post",
"type": "post",
"link": "https://yoursite.com/my-blog-post/",
"title": {
"rendered": "My Blog Post"
},
"content": {
"rendered": "<p>This is the content...</p>"
},
"excerpt": {
"rendered": "<p>Post excerpt...</p>"
},
"author": 1,
"featured_media": 456,
"categories": [5, 12],
"tags": [3, 7]
}

Example: Get Category by ID

Inputs:

  • Object Id: 5

Options:

  • Object: Category

Output - Object:

{
"id": 5,
"count": 23,
"description": "Posts about technology",
"link": "https://yoursite.com/category/technology/",
"name": "Technology",
"slug": "technology",
"taxonomy": "category",
"parent": 0
}

Common Use Cases

Post Verification

  • Check if post exists before updating
  • Verify post status before operations
  • Retrieve current post data for comparison
  • Validate post metadata

Category Lookup

  • Get category details by ID
  • Verify category exists
  • Check category post count
  • Retrieve category hierarchy information

Content Review

  • Retrieve post for manual review
  • Check post content before publishing
  • Verify post assignments (categories, tags)
  • Review post metadata

Data Extraction

  • Extract specific fields from post
  • Get post URL for sharing
  • Retrieve featured image ID
  • Extract custom meta fields

Workflow Conditions

  • Check post status to determine next action
  • Verify category before assignment
  • Validate object existence before update
  • Conditional logic based on object properties

Example Workflows

Update Post Only If Published

1. Get (Object: Post, Object Id: post_id)
2. Check if object.status === "publish"
3. If published:
- Update Post
Else:
- Skip update or handle differently

Get Post and Extract Information

1. Get (Object: Post, Object Id: 123)
2. JavaScript to extract:
- title: object.title.rendered
- url: object.link
- author_id: object.author
- categories: object.categories
3. Use extracted data in next steps

Verify Category Before Creating Post

1. Get (Object: Category, Object Id: category_id)
2. If successful:
- Create Post with this category
Else:
- Create Category first
- Then Create Post

Get Post Content for Translation

1. Get (Object: Post, Object Id: original_post_id)
2. Extract content: object.content.rendered
3. Translate content
4. Create Post in another language

Processing Retrieved Data

Extract Specific Fields

const post = msg.object;

return {
post_id: post.id,
title: post.title.rendered,
content: post.content.rendered,
excerpt: post.excerpt.rendered,
url: post.link,
status: post.status,
author_id: post.author,
featured_image_id: post.featured_media,
category_ids: post.categories,
tag_ids: post.tags
};

Check Post Status

const post = msg.object;

if (post.status === "publish") {
return { is_published: true };
} else if (post.status === "draft") {
return { is_draft: true };
} else {
return { status: post.status };
}

Get Category Hierarchy

const category = msg.object;

// If category has parent, you can get parent details
if (category.parent !== 0) {
return {
category_name: category.name,
has_parent: true,
parent_id: category.parent
};
} else {
return {
category_name: category.name,
is_top_level: true
};
}

Best Practices

  • Always validate the Object Id before calling Get
  • Handle cases where the object doesn't exist (error handling)
  • Use appropriate authentication for non-public content
  • Cache retrieved data if using it multiple times
  • Extract only the fields you need for better performance
  • Check object.status before performing updates
  • Verify object exists before attempting delete
  • Use Get to validate IDs from external sources

Performance Considerations

  • Get is efficient - retrieves only one object
  • Faster than listing all objects and filtering
  • Minimal data transfer
  • No pagination needed
  • Use when you have the exact ID

Comparison: Get vs List

Use Get when:

  • You have the exact object ID
  • You need complete data for one object
  • You want to verify an object exists
  • You need current state of specific object

Use List when:

  • You need multiple objects
  • You don't have specific IDs
  • You want to filter by criteria
  • You need to browse or search

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: 404 Not Found

  • The object with that ID doesn't exist
  • Verify the ID is correct
  • Check if object was deleted
  • Ensure you're querying the correct site

Error: 403 Forbidden

  • Authentication required for this object
  • Provide valid credentials
  • Check user permissions
  • Object may be private or draft

Retrieved draft post but expected published:

  • Check the object.status field
  • Post may not be published yet
  • Verify you have the correct post ID

Integration Examples

Get and Update Post

1. Get (Object: Post, Object Id: 123)
2. Modify object properties:
- object.title = "Updated Title"
- object.content = "Updated content..."
3. Update (Object: Post, Object Id: 123, Object: modified_object)

Clone Post to Another Category

1. Get (Object: Post, Object Id: original_id)
2. Modify object:
- Remove id field
- Change categories: [new_category_id]
- Update title (append "Copy")
3. Create Post with modified object

Check Category Usage

1. Get (Object: Category, Object Id: category_id)
2. Check object.count
3. If count > 0:
- Category is in use, handle accordingly
Else:
- Category is empty, safe to delete

Extract and Store Post Metadata

1. Get (Object: Post, Object Id: post_id)
2. Extract meta fields:
- custom_field_1: object.meta.custom_field_1
- custom_field_2: object.meta.custom_field_2
3. Store in database or data table
4. Use for reporting or analysis

Advanced Usage

Batch Get Multiple Posts

For each post_id in post_id_list:
1. Get (Object: Post, Object Id: post_id)
2. Store object in array
3. Continue to next

Result: Array of complete post objects

Verify Post Before Delete

1. Get (Object: Post, Object Id: post_id)
2. Check conditions:
- Is it older than 1 year?
- Has 0 comments?
- Not in important categories?
3. If all conditions met:
- Delete (Object: Post, Object Id: post_id)

Content Audit

1. List Posts → Get all post IDs
2. For each post_id:
- Get (Object: Post, Object Id: post_id)
- Analyze content quality
- Check for missing metadata
- Record issues
3. Generate audit report