entry.onPublish hook #9394
-
A hook for when an entry is actually published. onSaveEntry fires when a user saves the entry, but if an entry is set to publish in the future, no event is fired. This would also be a unique call which is fired only when a user manually publishes a post. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
This module can be used to track the moment an entry goes live. |
Beta Was this translation helpful? Give feedback.
-
|
Just PR’d a native solution for this for Craft 5.7: there’s a new |
Beta Was this translation helpful? Give feedback.
Just PR’d a native solution for this for Craft 5.7: there’s a new
staticStatusesconfig setting, which can be used to opt into having entry statuses stored statically and only updated on entry save; plus anupdate-statusesCLI command that can be hit with a Cron job, which updates any entries with out-of-date statuses, triggeringsaveevents and clearing caches in the process. (Plus a newEntry::$oldStatusproperty that can be checked fromsaveevent handlers to see if the status just changed.)