List Posts
Retrieves a list of posts from WordPress with optional filtering by status and pagination support.
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).
Options
- Status - Filter posts by status. Required. Options:
- Publish - Published posts visible to the public
- Future - Scheduled posts for future publication
- Draft - Draft posts not yet published
- Pending - Posts pending review
- Private - Private posts visible only to authorized users
- Page - Page number for pagination (default: 1). Use this to retrieve different pages of results.
- Per Page - Number of posts per page (default: 100). Maximum value depends on WordPress configuration.
- 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.
Outputs
- Total Posts - The total number of posts matching the status filter.
- Total Pages - The total number of pages available for the current filter and per-page setting.
- Post List - An array of post objects matching the specified criteria.
How It Works
The List Posts node retrieves posts from WordPress using the WordPress REST API with filtering and pagination.
When executed, the node:
- Validates the status parameter is selected
- Constructs the API request with status, page, and per-page parameters
- Sends a GET request to
/wp-json/wp/v2/postsendpoint - Retrieves pagination metadata from response headers
- Returns the posts array along with total count and page information
Post Object Structure
Each post in the returned Post List 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
- 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)
- categories - Array of category IDs
- tags - Array of tag IDs
- meta - Custom meta fields
Authentication Methods
Method 1: Using Connect Node (Recommended)
Connect → Store Client Id → List Posts (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+)
- Appropriate user permissions:
- Published posts can be viewed by anyone
- Draft, pending, and private posts require authentication
- User must be the author or have edit permissions to see their own drafts
Pagination
The node supports pagination for handling large numbers of posts:
- Page - Specifies which page to retrieve (starts at 1)
- Per Page - How many posts to return per page (default: 100)
- Total Posts output - Shows total number of matching posts
- Total Pages output - Shows how many pages are available
Pagination Example
To retrieve all posts across multiple pages:
- Start with Page = 1
- Check Total Pages output
- Use a loop to iterate through pages 1 to Total Pages
- Increment Page value for each iteration
Error Handling
The node will return specific errors in the following cases:
- Status not selected or invalid
- Invalid page or per-page values
- Authentication failure (for non-public posts)
- Network connection errors
- WordPress REST API disabled
Usage Notes
- Published posts can be retrieved without authentication
- Draft, pending, and private posts require authentication
- The Status option is required - you must select a value
- The maximum per-page value may be limited by WordPress settings (typically 100)
- Empty arrays are returned if no posts match the criteria
- Posts are returned in reverse chronological order by default
- Total Posts and Total Pages help with pagination logic
Example: List All Published Posts
Options:
- Status: Publish
- Page: 1
- Per Page: 50
Outputs:
- Total Posts: 247
- Total Pages: 5
- Post List: Array of 50 post objects
Example: Paginated Retrieval
To retrieve all draft posts across multiple pages:
1. List Posts (Status: Draft, Page: 1, Per Page: 100)
2. Store Total Pages → total_pages
3. Loop from page 1 to total_pages:
- List Posts (Status: Draft, Page: current_page, Per Page: 100)
- Process Post List
Example: Check for Scheduled Posts
Options:
- Status: Future
- Page: 1
- Per Page: 100
This retrieves all scheduled posts waiting for publication.
Common Use Cases
Content Audit
- List all published posts to analyze content
- Export post data for reporting
- Check post metadata and categories
Draft Management
- Review all draft posts
- Identify posts pending review
- Clean up old drafts
Scheduled Post Monitoring
- List future posts to verify publication schedule
- Monitor upcoming content
- Adjust publication timing
Data Migration
- Export posts from WordPress
- Backup post content
- Transfer content to another system
Content Analysis
- Analyze post patterns and frequency
- Review category and tag usage
- Identify posts needing updates
Best Practices
- Use appropriate status filters to get only the posts you need
- Implement pagination for sites with many posts to avoid timeouts
- Start with a smaller per-page value for testing
- Store the Total Pages value before starting pagination loops
- Handle empty result arrays gracefully
- Use published status when you don't need authentication
- Filter by draft status during content review workflows
- Monitor future posts to manage publication schedules
Performance Considerations
- Smaller per-page values result in faster responses
- Large per-page values may cause timeouts on sites with many posts
- Retrieving draft/pending/private posts is slower due to authentication
- Published posts can be cached by WordPress for better performance
- Consider filtering on the WordPress side using status rather than retrieving all posts
Troubleshooting
Error: "Status should be selected"
- Ensure you've selected a status from the dropdown menu
- The status field is required and cannot be left empty
Empty Post List returned:
- Verify posts exist with the selected status
- Check authentication if retrieving non-public posts
- Confirm the page number is within the Total Pages range
Timeout errors:
- Reduce the Per Page value
- Check WordPress site performance
- Verify network connectivity
Working with Results
The Post List output is an array that can be processed using:
- Loop nodes to iterate through each post
- Filter operations to find specific posts
- Data transformation to extract specific fields
- Export operations to save to CSV, Excel, or databases
Advanced Filtering
While this node filters by status, you can perform additional filtering:
- Retrieve posts using List Posts
- Use JavaScript or Filter nodes to:
- Filter by author
- Filter by date range
- Filter by category/tag
- Search by title or content
- Filter by custom fields