humanmade / humanmade/Workflows
add_message_action passes post ID of the workflow post rather than an ID of the triggering post
- Dominant language
- PHP
- Stars
- 106
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
The documentation and sample code for `Event::add_message_action()` indicates that a `$post_id` parameter is passed into the callable parameter. However, the post ID that's actually passed is the ID of the `hm_workflow` post, not of the post itself. Therefore, the sample code provided:
```php
Event::register( 'action_that_passes_post_object' )
->add_message_action(
'view',
'View post',
function ( $post_id ) {
return get_the_permalink( $post_id );
}
);
```
Would actually return the permalink of the _workflow_ post, rather than the actual post to be viewed. Adding a callable `$args` parameter and `$schema` does not appear to make any difference.
Contributor guide
Assessment
This issue has not been assessed yet.