Disconnect
Disconnects from WordPress and releases the client connection, freeing up system resources.
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 returned from the Connect node. This identifies which connection to disconnect.
How It Works
The Disconnect node terminates an active WordPress connection and removes the stored client from memory.
When executed, the node:
- Validates the provided Client Id
- Locates the stored connection using the Client Id
- Removes the connection from the internal connection pool
- Frees up memory resources
Requirements
- A valid Client Id from a previous Connect node execution
- An active WordPress connection that hasn't already been disconnected
Error Handling
The node will return specific errors in the following cases:
- Empty or missing Client Id
- Invalid Client Id (connection doesn't exist or has already been disconnected)
Usage Notes
- The Disconnect node should be executed after all WordPress operations are complete
- Once disconnected, the Client Id can no longer be used
- If you need to perform more operations after disconnecting, you must create a new connection with the Connect node
- The node gracefully handles already-disconnected clients
- Connections are automatically cleaned up when the flow stops, but explicitly disconnecting is still recommended
Best Practices
- Always pair Connect nodes with Disconnect nodes in your flow
- Place the Disconnect node in a Finally block to ensure cleanup even if errors occur
- Disconnect as soon as you're done with WordPress operations to free resources
- Use a single Disconnect node at the end of your WordPress workflow
- Don't reuse Client Ids after disconnecting
Example Flow Structure
Try:
1. Connect → Store Client Id
2. Create Post
3. List Posts
4. Update Post
Finally:
5. Disconnect (using stored Client Id)
This ensures the connection is always cleaned up, even if an error occurs during operations.
Resource Management
- Each active connection consumes memory resources
- Long-running flows with many connections can accumulate resources
- Properly disconnecting prevents resource leaks
- The connection pool is thread-safe and handles concurrent disconnections
Common Patterns
Simple Disconnect
Connect → Operations → Disconnect
Error-Safe Disconnect
Try:
Connect → Operations
Catch:
Handle Error
Finally:
Disconnect
Multiple Connection Management
If your flow uses multiple WordPress sites, track each Client Id separately and disconnect them all:
Connect Site 1 → Store as client_id_1
Connect Site 2 → Store as client_id_2
... Perform operations ...
Disconnect client_id_1
Disconnect client_id_2
Troubleshooting
Error: "Client ID cannot be empty"
- Ensure you're passing the Client Id from the Connect node
- Check that the variable name matches between Connect and Disconnect nodes
Error: "Invalid Client Id"
- The connection may have already been disconnected
- The Client Id might be from a previous flow execution
- Verify the Client Id is being passed correctly through your flow
Performance Considerations
- Disconnecting is a lightweight operation
- It's safe to disconnect multiple times (subsequent calls will simply do nothing)
- For high-frequency automation, consider connection pooling patterns
- In most cases, a single Connect/Disconnect pair per flow is sufficient