# `MishkaCmsCore.Runtime.Resources.Preparations.PluginQueryHook`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/resources/__preparations/plugin_query_hook.ex#L5)

A reusable read `Preparation` that lets a plugin **adjust the query** before a read runs — the
WordPress `pre_get_posts` / `posts_where`, Joomla `onContentSearch` seam.

Add it to the read actions you want to make pluggable:

    read :published do
      prepare MishkaCmsCore.Runtime.Resources.Preparations.PluginQueryHook
      ...
    end

It hands the plugin the `Ash.Query` for `"<app>:<resource>:query_<action>"`; the plugin returns a
modified `Ash.Query` (e.g. `Ash.Query.filter/2`, `Ash.Query.sort/2`). With no plugin registered, the
query passes through untouched. Reads are not atomic, so this changes no authorization behaviour.

> Reads run **per request** — keep plugins cheap and add only indexed filters/sorts; never break the
> resource's base/tenant filters.

See `MishkaInstaller.Event.Hook`.

# `init`

# `supports`

# `temporal_safe?`

---

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