Include PHP code snippets in a workflow
Execute PHP is a special action which allows you to execute arbitrary PHP code during the execution of workflow.
You must be careful. Using this action with inappropriate PHP code can completely destroy your site in no time.
This action will check PHP syntax before save the workflow and before execute PHP code. If syntax of the code is not correct it will not be executed. If something goes wrong during execution of the workflow, inspect error messages on the Operation Log page.
You don’t need to use opening and closing tags <?php and ?> in your code.
Execute PHP action do not provide a result until you specify return statement in the code. If you want to use some value in the next action in the workflow, you need to specify return statement with corresponding value. You can get this value by using {PREVIOUS}
pattern in the next action in the workflow.
Use $previous
variable to get a value passed by the previous action in the workflow and $arg
variable to get a value passed by WordPress or the calling workflow.