humanmade / humanmade/Workflows

add_message_action passes post ID of the workflow post rather than an ID of the triggering post

Open
#109 3 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.