humanmade / Workflows

Powerful workflows for WordPress
https://github.com/humanmade/Workflows/wiki
GNU General Public License v3.0
96 stars 7 forks source link

Stored workflows are loaded too early. #158

Closed gonzomir closed 3 years ago

gonzomir commented 3 years ago

When trying to extend Workflows with events on custom post types I constantly get beaten by the fact that stored workflows load too early. Although I can register events later and the UI is fully functional, when the plugin loads the stored workflow, it is discarder because the event is not yet registered. Registering the event earlier doesn't work for me because the custom post type(s) can't be registered that early. One could try to add the post types as UI field that pulls data from REST API, but then get_rest_url can't be used because WP_Rewrite is not yet initialized.

My suggestion is to trigger hm.workflows.init in the init action, I didn't see any side effects and it makes creating custom workflows much easier.

roborourke commented 3 years ago

The 0.4.0 release should be available shortly. What version of Altis are you using this with?

gonzomir commented 3 years ago

I'm using it with Altis 7. I was thinking, I can add 0.4.0 as a dependency and it'll overwrite the one included with Altis, right?

roborourke commented 3 years ago

Not quite, you’ll need to alias it eg “0.4.0 as 0.3.17” for the version constraint

gonzomir commented 3 years ago

Yes, that worked, closing this issue, thanks!