# `MishkaCmsCore.Runtime.Resources.Changes.PluginBeforeHook`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/resources/__changes/plugin_before_hook.ex#L5)

A reusable `before_action` change that lets a plugin **transform or reject** an action before it runs
(the WordPress `wp_insert_post_data` / `pre_comment_approved`, Joomla `onContentBeforeSave` seam).

Add it to the actions you want to gate:

    create :create_public do
      change MishkaCmsCore.Runtime.Resources.Changes.PluginBeforeHook
      ...
    end

It hands the plugin the **changeset** for `"<app>:<resource>:before_<action>"`; the plugin returns the
(possibly modified) changeset, or `Ash.Changeset.add_error(changeset, ...)` to reject. With no plugin
registered, the changeset passes through untouched.

> A `before_action` makes the action **non-atomic**. That is harmless on `create` actions, but on
> `update`/`destroy` it flips an *unauthorized* request from 403 to 404 (the non-atomic path loads the
> record first). So prefer it on creates + admin-only actions; rely on the after-notifier elsewhere.

See `MishkaCmsCore.Runtime.Resources.Notifiers.PluginHook` (after events) and `MishkaInstaller.Event.Hook`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
