Morphic hooks and filters reference
This page lists the WordPress actions and filters that Morphic (the free plugin) runs.
Actions
Morphic runs these actions. Arguments are listed in the order they are passed.
| Action | When it runs | Arguments |
|---|---|---|
morphic/ready | On init, priority 5. | None. |
morphic/rest | When REST routes are registered. | RouteRegistrar object. |
morphic/model_saved | After a model is saved. | $manifest. |
morphic/manifest/check | When a model is checked. | $manifest, $registry. |
morphic/writing | Before an entry is written. | $manifest, cleaned data, previous data or null, actor. |
morphic/written | After an entry is written. | Store, $manifest, node, previous node or null, changed field names, create, update or restore. |
morphic/deleting | Before an entry is deleted. | Store, $manifest, node, time. |
morphic/deleted | After an entry is deleted. | Store, $manifest, node, time. |
morphic/cleared | After an entry is cleared. | Store, entry ID. |
morphic/refresh | When nodes are refreshed. | Store, $manifest, nodes. |
morphic/work | In each background build run. | Store, deadline. |
morphic/key_used | On every matching API key request, before the throttle check. | API key record. |
morphic/webhook_delivered | After each webhook attempt. | Hook, operation, HTTP code (0 when the request fails), error message or null. |
Filters
Morphic applies these filters. Return a value of the same type as the default.
| Filter | Default | Arguments |
|---|---|---|
morphic/pro | ['active' => false, 'licensed' => false, 'features' => []] | None. Read in Admin.php and Rest.php. |
morphic/upgrade_url | 'https://morphicwp.com' | None. |
morphic/i18n | Messages from I18n::messages('morphic', MORPHIC_FILE). | Messages array. |
morphic/fast_url | null | None. |
morphic/paths | Paths of the type response. | Paths, $manifest. |
morphic/openapi/paths | Paths of the OpenAPI document. | Paths. |
morphic/openapi/schemas | Schemas of the OpenAPI document. | Schemas. |
morphic/can_full | false | $allowed, $manifest. Runs only for the full action, after the API key check fails. Its result decides the action. |
morphic/shape | Node as shaped for the reader. | Node, $manifest, $full. |
morphic/unseal | null | $plain, stored value, field, $manifest. Runs for sealed fields when the reader has full access. A value that is not a string is replaced with the redacted value. |
morphic/seal | null | $plain string, field, $manifest. Must return a string. Without one, the save fails with "{field} is a sealed field; sealing needs Morphic Pro". |
morphic/write_cost | 0 | Cost value, $manifest. |
morphic/kinds | ['node', 'component'] | Kinds list. |
morphic/secret_kinds | ['hash'] | Secret kinds list. |
morphic/structures | Index structures of the model. | Structures, $manifest. |
morphic/pending | false | Pending flag. |
morphic/fill_batch | 200 | Batch size, type, structure, name. |
morphic/fill_many | Nodes. | Nodes, Store, $manifest, structure, name. |
morphic/fill | null | null, Store, $manifest, structure, name, node. A non-null return value is used as the error message. |
morphic/clear | 0 | 0, Store, type, structure, name, limit. |
Notes
morphic/can_fullandmorphic/unsealcontrol what a reader without an administrator role can see. See Roles and permissions.- Morphic sends a webhook with a signature when the hook has a secret. See Send changes to a webhook.