[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GKJG37VB97NSBMRVB2DR7E":3,"skill-same:01M6GKJG37VB97NSBMRVB2DR7E":95},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":6,"updatedAt":52,"install":53,"resources":66},"01M6GKJG37VB97NSBMRVB2DR7E","acf-native",null,"Use when building or reviewing ACF field behaviour or the post save flow - validate before publish, required\u002Fmaxlength settings, hiding a field (conditional_logic), dynamic choices, running code after save - acf\u002Fvalidate_value, acf\u002Fload_field, acf\u002Fprepare_field, acf\u002Fsave_post, acf.getField, wp_insert_post_data, save_post - including projects where ACF may not be installed (Radicle). Maps each need to the native mechanism verified in local source. For ACF Composer scaffolding use acorn-scaffolding; for escaping ACF output use wp-security-escaping.","hekivo\u002Fkivo-wise","hekivo","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F278159278?v=4","01M6GKH8S3Z4CAJ9RRR607G1WJ","Hekivo","01M6GKH8XNM7HTVF4DC86MA8RG",14,"MIT","https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fplugins\u002Fkivo-wise\u002Fskills\u002Facf-native\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"acf native","native","use","output","composer","post","logic","local","scaffolding","maps","security","settings","projects","save","data","flow","publish","code","prepare","validate","2026-11-10 10:12:30",false,"---\nname: acf-native\ndescription: Use when building or reviewing ACF field behaviour or the post save flow - validate before publish, required\u002Fmaxlength settings, hiding a field (conditional_logic), dynamic choices, running code after save - acf\u002Fvalidate_value, acf\u002Fload_field, acf\u002Fprepare_field, acf\u002Fsave_post, acf.getField, wp_insert_post_data, save_post - including projects where ACF may not be installed (Radicle). Maps each need to the native mechanism verified in local source. For ACF Composer scaffolding use acorn-scaffolding; for escaping ACF output use wp-security-escaping.\n---\n\n# ACF and WordPress: native first\n\nMost \"new\" behaviour around fields already exists as a field setting, an ACF hook or a WordPress hook. Re-implementing it duplicates ACF, splits the rule in two places and usually breaks in the block editor. This skill names the native mechanism, makes you check it in the installed source, and only then allows custom code.\n\nRunner commands are written as placeholders filled from the session context: `{{runner.wp}}` (Lando default `lando wp`), `{{runner.acorn}}` (`lando wp acorn`), `{{runner.composer}}` (`lando composer`), `{{runner.cache}}` (the project's cache-clear command). Never run `wp`, `composer` or `php` on the host.\n\n## When to use\n\n- Validating field values before publish (cross-field rules, external data, limits).\n- Choices that depend on data, hiding or locking a field per user\u002Fstate, computed values.\n- Logic that must run after ACF stored the values, or on saves that never post the ACF form.\n- Admin or block-editor JavaScript that touches ACF fields.\n- Reviewing code for custom endpoints, meta boxes or editor hooks that duplicate ACF.\n\n## Inputs required\n\n- The need in one sentence (\"block publishing when the external ID is already used\").\n- The active profile and app path from the session context.\n- Whether ACF (Pro) is installed and its version: `{{runner.wp}} plugin list --name=advanced-custom-fields-pro --fields=name,status,version` (or `advanced-custom-fields`).\n- Where the field group is defined (ACF Composer class, local JSON, or the admin UI).\n\n## Procedure\n\nCommands: write every command with the runner value from the session context filled in (for example `lando wp acorn optimize:clear`), never a bare `wp`\u002F`composer`\u002F`php`\u002F`npm`, never the placeholder, never \"prefix with lando if you use it\". Commands that run in CI or a deploy script go in a separate block labelled with where they run.\n\n1. **Detect ACF first, before naming any `acf\u002F*` hook.** Look at `site.versions` in the session context, the lock file (`composer.lock` entries `wpengine\u002Fadvanced-custom-fields-pro`, `*\u002Fadvanced-custom-fields`) and the plugins folder. Say what you found.\n   - **ACF absent** (the default on `radicle-app`): solve it with native WordPress and stop there. Register the fields with `register_post_meta()` (`show_in_rest`, `single`, `type`, a `sanitize_callback` and an `auth_callback`); block publish-only with `rest_pre_insert_{post_type}` returning a `WP_Error` (the block editor saves through REST; new meta values are in `$request['meta']`, fall back to stored meta; check only when the target status is `publish` or `future`, so drafts still save) plus `wp_insert_post_data` for classic, quick-edit and CLI saves (keep the post a draft instead of publishing). Register both from a service provider (on `radicle-app`, one listed in `composer.json` `extra.acorn.providers`). Be honest about the UI: the `WP_Error` message shows as an editor notice that names the field, not inline under it. Recommend adding ACF only if the user asks for an admin field UI or inline field errors, and then through the project's Composer registry (wp-packages.org `wp-plugin\u002F*` by default; see `wp-composer-plugins`), never wpackagist unless the project already uses it.\n   - **ACF present**: continue with step 2.\n2. **Name the need** in one sentence.\n3. **Find the mechanism** in the table below, then the signature in [references\u002Fhooks.md](references\u002Fhooks.md) or [references\u002Fjs-api.md](references\u002Fjs-api.md).\n4. **Verify the behaviour in the installed source**, not from memory (paths relative to the WordPress content dir and the core dir):\n   - ACF PHP: `plugins\u002Fadvanced-custom-fields-pro\u002Fincludes\u002Fvalidation.php`, `acf-field-functions.php`, `acf-value-functions.php`, `acf-form-functions.php`, `forms\u002Fform-post.php`.\n   - ACF JS: `plugins\u002Fadvanced-custom-fields-pro\u002Fassets\u002Fbuild\u002Fjs\u002Facf-input.min.js` (minified; search for the action or filter name).\n   - WordPress: `wp-includes\u002Fpost.php` (`wp_insert_post`, `register_post_meta`), `wp-includes\u002Fmeta.php` (`register_meta`), `wp-includes\u002Frest-api\u002Fendpoints\u002Fclass-wp-rest-posts-controller.php` (`rest_pre_insert_{post_type}`), `wp-admin\u002Fincludes\u002Fpost.php` (`edit_post`). Name the file and line you checked in the answer.\n5. **Implement with the native mechanism.** Field rules belong in the field definition (ACF Composer `app\u002FFields\u002F**` or local JSON). Hooks go in a service provider `boot()` (or the project's bootstrap `filters.php` \u002F `actions.php`) and delegate to a class in `app\u002F`.\n6. **Custom code only for a real gap** (example: ACF does not validate quick edit, bulk edit, WP-CLI or REST saves). Write the reason in the issue or PR (\"Native APIs used\") and in a code comment next to the custom code.\n7. **Audit**: tell the user to run `node scripts\u002Faudit-native.mjs \u003Capp-path>` (script path relative to this skill folder; pass the detected app path, `.` on `radicle-app`) and run it yourself when you can. Read every finding you introduced. Output is JSON: `tool`, `findings[]`, `notes[]`.\n8. Clear caches after PHP changes: `{{runner.cache}}`.\n\n### Profiles\n\n| | `sage-theme` | `acorn-mu-plugin` | `radicle-app` |\n|---|---|---|---|\n| ACF present | usually (ACF Pro via Composer) | usually (ACF Pro via Composer) | **not installed by default**; confirm before using any `acf\u002F*` hook |\n| Field definitions | theme `app\u002FFields\u002F**` (ACF Composer) or local JSON | plugin `app\u002FFields\u002F**` (ACF Composer) | register meta natively (`register_post_meta` with `show_in_rest`) and block attributes; add ACF only if the project chose it |\n| Where hooks go | theme provider `boot()` or `app\u002Ffilters.php` | plugin provider `boot()` or the plugin's bootstrap `filters.php` \u002F `actions.php` | provider listed in `composer.json` `extra.acorn.providers` |\n| Native-first still applies to | ACF + WordPress hooks | ACF + WordPress hooks | WordPress hooks only: `wp_insert_post_data`, `rest_pre_insert_{post_type}`, `register_post_meta` `sanitize_callback` \u002F `auth_callback`, block attributes |\n\n### Need → native mechanism\n\n| Need | Use | Not |\n|---|---|---|\n| Required, max length, number range, min\u002Fmax rows | Field settings: `required`, `maxlength`, `min`\u002F`max`, repeater `min`\u002F`max` | Re-checking them in a custom endpoint or JS |\n| Business validation on save (cross-field, external data) | `acf\u002Fvalidate_value\u002Fkey={field_key}` returning `true` or a message; sibling values from `$_POST['acf'][\u003Cfield_key>]`; form-level errors through `acf\u002Fvalidate_save_post` + `acf_add_validation_error()` | `editor.preSavePost`, a custom \"check\" endpoint |\n| Choices that depend on data | `acf\u002Fload_field\u002Fkey=…` (prefer `key=`: unique and unaffected by other code filtering by `name=`) | Hard-coded choices, JS that injects options |\n| Hide or lock a field per context | `acf\u002Fprepare_field[\u002Fkey=…]` returning `false` hides it; `readonly` \u002F `disabled` settings | CSS such as `acf-hidden` (it does not hide on its own) |\n| Value nobody types (hashes, timestamps, flags) | Plain post meta written by code | A readonly ACF field |\n| Show\u002Fhide inside one field group | `conditional_logic` in the field definition | JS |\n| Show\u002Fhide across field groups | ACF JS API (`acf.getField()`, `ready_field\u002Fkey=…`) | Page reloads |\n| Transform before storing \u002F after reading | `acf\u002Fupdate_value[\u002Fkey=…]`, `acf\u002Fformat_value[\u002Fkey=…]`, defaults with `acf\u002Fload_value` | Post-processing in templates |\n| Logic that needs the saved values | `acf\u002Fsave_post` priority > 10 (ACF stores values at 10); priority \u003C 10 sees only `$_POST['acf']` | `save_post` \u002F `wp_insert_post_data` during the block editor REST request (old meta) |\n| Rule on saves without the ACF form (quick\u002Fbulk edit, CLI, REST) | `wp_insert_post_data` \u002F `transition_post_status`, skipping requests that carry `$_POST['acf']` | Assuming ACF validation runs there (it does not) |\n| Assets for screens with ACF forms | `acf\u002Finput\u002Fadmin_enqueue_scripts` + `get_current_screen()` check | `admin_enqueue_scripts` on every admin page |\n| Editor behaviour in JS | `acf.addFilter('select2_args')`, `acf.addAction('ready_field\u002Fkey=…')`, `field.val()`, repeater `add()` \u002F `remove($row)` \u002F `$rows()` | Raw DOM edits of ACF markup |\n| Expose field groups and content to AI agents | ACF 6.8 Abilities (`acf\u002Fsettings\u002Fenable_acf_ai`, per-item `allow_ai_access`); see wp-abilities-mcp | Custom REST endpoints that describe fields |\n\nDepth: [references\u002Fsave-flow.md](references\u002Fsave-flow.md) (classic vs block editor sequence), [references\u002Ftraps.md](references\u002Ftraps.md), [references\u002Fdocs.md](references\u002Fdocs.md).\n\n## Verification\n\n- The rule fires where expected: publish in the block editor (validation error on the field), save a draft (no validation), quick edit (only your WordPress-hook guard runs).\n- `node scripts\u002Faudit-native.mjs \u003Capp-path>` shows no new finding without a written reason.\n- `{{runner.wp}} eval 'var_dump(has_filter(\"acf\u002Fvalidate_value\u002Fkey=field_x\"));'` returns a priority, not `false` (the provider booted).\n- Tests, if the project has them, cover the validator class (`{{runner.test}}`).\n\n## Failure modes\n\n| Symptom | Cause | Fix |\n|---|---|---|\n| Validation does not run when saving a draft | ACF's block-editor wrapper validates only when the target status is `publish` or `future`; autosave and preview skip it | Expected; enforce draft rules with a WordPress hook if they really matter |\n| A guard on `wp_insert_post_data` rejects a valid first publish | The block editor sends the REST request first, before the meta-box request carries `$_POST['acf']`; meta is still old | Validate with `acf\u002Fvalidate_value`; react in `acf\u002Fsave_post` > 10; skip the REST request in the guard |\n| `acf\u002Fsave_post` handler reads old values | Priority below 10 | Use priority 20 (or read `$_POST['acf']` deliberately) |\n| Filter on `name=` stops working or fights another plugin\u002Ftheme | Several fields share the name, or other code filters the same name | Use `\u002Fkey=field_…` |\n| Field \"hidden\" with `acf-hidden` still renders | The class alone does not hide | `acf\u002Fprepare_field` returning `false`, or make it code-managed meta |\n| JSON stored with `update_post_meta()` is corrupted | Meta functions unslash the value | `update_post_meta($id, $key, wp_slash($json))` |\n| `acf\u002F*` hooks never fire on `radicle-app` | ACF is not installed | Use `register_post_meta` + `rest_pre_insert_{post_type}` \u002F `wp_insert_post_data` (step 1); add ACF only on request, through the project's registry (wp-composer-plugins) |\n| Renamed ACF Composer group loses data | Field keys derive from group + field names; `_\u003Cname>` reference meta is orphaned | Plan renames with a migration that rewrites the reference meta |\n\n## Escalation\n\n- Hook timing or \"which request runs this hook\": wp-hooks-lifecycle.\n- Creating the field group, block or options page class: acorn-scaffolding.\n- Escaping and sanitising the values on output: wp-security-escaping.\n- The mechanism seems missing in the installed version: check the ACF changelog for the installed version through docs-brain before writing custom code, and tell the user which gap you found.\n\n\u003C!-- verified:\nwp-content\u002Fplugins\u002Fadvanced-custom-fields-pro\u002Fincludes\u002Fvalidation.php:357-360 — validate_value type\u002Fname\u002Fkey\u002Fgeneric filters with ($valid,$value,$field,$input);\nvalidation.php:223 — acf_add_validation_error($input,$message); :257 do_action('acf\u002Fvalidate_save_post'); :38 wp_ajax_acf\u002Fvalidate_save_post;\nincludes\u002Facf-field-functions.php:70,81 — acf\u002Fload_field + type\u002Fname\u002Fkey variations; :568,575 acf\u002Fprepare_field + variations;\nincludes\u002Facf-value-functions.php:146 load_value ($value,$post_id,$field); :200 format_value adds $escape_html; :244 update_value ($value,$post_id,$field,$original);\nincludes\u002Facf-form-functions.php:139-152 — acf_save_post kses-filters $_POST['acf'] for users without unfiltered_html, then do_action('acf\u002Fsave_post'); :180 _acf_do_save_post at default priority 10;\nincludes\u002Fforms\u002Fform-post.php:42 — ACF saves on save_post priority 10;\nincludes\u002Fassets.php:394 — do_action('acf\u002Finput\u002Fadmin_enqueue_scripts');\nassets\u002Fbuild\u002Fjs\u002Facf-input.min.js — savePost wrapper: validates only when status is publish\u002Ffuture, skips isAutosave\u002FisPreview; \"\u003Caction>_field\u002Fkey=\" variations built for ready\u002Fappend\u002Fetc.;\nacf.php:185 — enable_acf_ai default false; src\u002FAI\u002FAI.php:30-46 Abilities only when enabled;\nradicle-app facts checked against a licensed local Radicle project; not reproduced here;\nwp\u002Fwp-includes\u002Frest-api\u002Fendpoints\u002Fclass-wp-rest-posts-controller.php:1531 — rest_pre_insert_{post_type}($prepared_post,$request); :750-754,951-955 a WP_Error from prepare_item_for_database aborts create\u002Fupdate;\nwp\u002Fwp-includes\u002Fpost.php:2812 register_post_meta; meta.php:1449-1450,1512-1525 sanitize_callback\u002Fauth_callback defaults and sanitize_{type}_meta_{key}_for_{subtype} filter; post.php:4978 wp_insert_post_data($data,$postarr,$unsanitized_postarr,$update).\n-->\n","# ACF and WordPress: native first\n\nMost \"new\" behaviour around fields already exists as a field setting, an ACF hook or a WordPress hook. Re-implementing it duplicates ACF, splits the rule in two places and usually breaks in the block editor. This skill names the native mechanism, makes you check it in the installed source, and only then allows custom code.\n\nRunner commands are written as placeholders filled from the session context: `{{runner.wp}}` (Lando default `lando wp`), `{{runner.acorn}}` (`lando wp acorn`), `{{runner.composer}}` (`lando composer`), `{{runner.cache}}` (the project's cache-clear command). Never run `wp`, `composer` or `php` on the host.\n\n## When to use\n\n- Validating field values before publish (cross-field rules, external data, limits).\n- Choices that depend on data, hiding or locking a field per user\u002Fstate, computed values.\n- Logic that must run after ACF stored the values, or on saves that never post the ACF form.\n- Admin or block-editor JavaScript that touches ACF fields.\n- Reviewing code for custom endpoints, meta boxes or editor hooks that duplicate ACF.\n\n## Inputs required\n\n- The need in one sentence (\"block publishing when the external ID is already used\").\n- The active profile and app path from the session context.\n- Whether ACF (Pro) is installed and its version: `{{runner.wp}} plugin list --name=advanced-custom-fields-pro --fields=name,status,version` (or `advanced-custom-fields`).\n- Where the field group is defined (ACF Composer class, local JSON, or the admin UI).\n\n## Procedure\n\nCommands: write every command with the runner value from the session context filled in (for example `lando wp acorn optimize:clear`), never a bare `wp`\u002F`composer`\u002F`php`\u002F`npm`, never the placeholder, never \"prefix with lando if you use it\". Commands that run in CI or a deploy script go in a separate block labelled with where they run.\n\n1. **Detect ACF first, before naming any `acf\u002F*` hook.** Look at `site.versions` in the session context, the lock file (`composer.lock` entries `wpengine\u002Fadvanced-custom-fields-pro`, `*\u002Fadvanced-custom-fields`) and the plugins folder. Say what you found.\n   - **ACF absent** (the default on `radicle-app`): solve it with native WordPress and stop there. Register the fields with `register_post_meta()` (`show_in_rest`, `single`, `type`, a `sanitize_callback` and an `auth_callback`); block publish-only with `rest_pre_insert_{post_type}` returning a `WP_Error` (the block editor saves through REST; new meta values are in `$request['meta']`, fall back to stored meta; check only when the target status is `publish` or `future`, so drafts still save) plus `wp_insert_post_data` for classic, quick-edit and CLI saves (keep the post a draft instead of publishing). Register both from a service provider (on `radicle-app`, one listed in `composer.json` `extra.acorn.providers`). Be honest about the UI: the `WP_Error` message shows as an editor notice that names the field, not inline under it. Recommend adding ACF only if the user asks for an admin field UI or inline field errors, and then through the project's Composer registry (wp-packages.org `wp-plugin\u002F*` by default; see `wp-composer-plugins`), never wpackagist unless the project already uses it.\n   - **ACF present**: continue with step 2.\n2. **Name the need** in one sentence.\n3. **Find the mechanism** in the table below, then the signature in [references\u002Fhooks.md](references\u002Fhooks.md) or [references\u002Fjs-api.md](references\u002Fjs-api.md).\n4. **Verify the behaviour in the installed source**, not from memory (paths relative to the WordPress content dir and the core dir):\n   - ACF PHP: `plugins\u002Fadvanced-custom-fields-pro\u002Fincludes\u002Fvalidation.php`, `acf-field-functions.php`, `acf-value-functions.php`, `acf-form-functions.php`, `forms\u002Fform-post.php`.\n   - ACF JS: `plugins\u002Fadvanced-custom-fields-pro\u002Fassets\u002Fbuild\u002Fjs\u002Facf-input.min.js` (minified; search for the action or filter name).\n   - WordPress: `wp-includes\u002Fpost.php` (`wp_insert_post`, `register_post_meta`), `wp-includes\u002Fmeta.php` (`register_meta`), `wp-includes\u002Frest-api\u002Fendpoints\u002Fclass-wp-rest-posts-controller.php` (`rest_pre_insert_{post_type}`), `wp-admin\u002Fincludes\u002Fpost.php` (`edit_post`). Name the file and line you checked in the answer.\n5. **Implement with the native mechanism.** Field rules belong in the field definition (ACF Composer `app\u002FFields\u002F**` or local JSON). Hooks go in a service provider `boot()` (or the project's bootstrap `filters.php` \u002F `actions.php`) and delegate to a class in `app\u002F`.\n6. **Custom code only for a real gap** (example: ACF does not validate quick edit, bulk edit, WP-CLI or REST saves). Write the reason in the issue or PR (\"Native APIs used\") and in a code comment next to the custom code.\n7. **Audit**: tell the user to run `node scripts\u002Faudit-native.mjs \u003Capp-path>` (script path relative to this skill folder; pass the detected app path, `.` on `radicle-app`) and run it yourself when you can. Read every finding you introduced. Output is JSON: `tool`, `findings[]`, `notes[]`.\n8. Clear caches after PHP changes: `{{runner.cache}}`.\n\n### Profiles\n\n| | `sage-theme` | `acorn-mu-plugin` | `radicle-app` |\n|---|---|---|---|\n| ACF present | usually (ACF Pro via Composer) | usually (ACF Pro via Composer) | **not installed by default**; confirm before using any `acf\u002F*` hook |\n| Field definitions | theme `app\u002FFields\u002F**` (ACF Composer) or local JSON | plugin `app\u002FFields\u002F**` (ACF Composer) | register meta natively (`register_post_meta` with `show_in_rest`) and block attributes; add ACF only if the project chose it |\n| Where hooks go | theme provider `boot()` or `app\u002Ffilters.php` | plugin provider `boot()` or the plugin's bootstrap `filters.php` \u002F `actions.php` | provider listed in `composer.json` `extra.acorn.providers` |\n| Native-first still applies to | ACF + WordPress hooks | ACF + WordPress hooks | WordPress hooks only: `wp_insert_post_data`, `rest_pre_insert_{post_type}`, `register_post_meta` `sanitize_callback` \u002F `auth_callback`, block attributes |\n\n### Need → native mechanism\n\n| Need | Use | Not |\n|---|---|---|\n| Required, max length, number range, min\u002Fmax rows | Field settings: `required`, `maxlength`, `min`\u002F`max`, repeater `min`\u002F`max` | Re-checking them in a custom endpoint or JS |\n| Business validation on save (cross-field, external data) | `acf\u002Fvalidate_value\u002Fkey={field_key}` returning `true` or a message; sibling values from `$_POST['acf'][\u003Cfield_key>]`; form-level errors through `acf\u002Fvalidate_save_post` + `acf_add_validation_error()` | `editor.preSavePost`, a custom \"check\" endpoint |\n| Choices that depend on data | `acf\u002Fload_field\u002Fkey=…` (prefer `key=`: unique and unaffected by other code filtering by `name=`) | Hard-coded choices, JS that injects options |\n| Hide or lock a field per context | `acf\u002Fprepare_field[\u002Fkey=…]` returning `false` hides it; `readonly` \u002F `disabled` settings | CSS such as `acf-hidden` (it does not hide on its own) |\n| Value nobody types (hashes, timestamps, flags) | Plain post meta written by code | A readonly ACF field |\n| Show\u002Fhide inside one field group | `conditional_logic` in the field definition | JS |\n| Show\u002Fhide across field groups | ACF JS API (`acf.getField()`, `ready_field\u002Fkey=…`) | Page reloads |\n| Transform before storing \u002F after reading | `acf\u002Fupdate_value[\u002Fkey=…]`, `acf\u002Fformat_value[\u002Fkey=…]`, defaults with `acf\u002Fload_value` | Post-processing in templates |\n| Logic that needs the saved values | `acf\u002Fsave_post` priority > 10 (ACF stores values at 10); priority \u003C 10 sees only `$_POST['acf']` | `save_post` \u002F `wp_insert_post_data` during the block editor REST request (old meta) |\n| Rule on saves without the ACF form (quick\u002Fbulk edit, CLI, REST) | `wp_insert_post_data` \u002F `transition_post_status`, skipping requests that carry `$_POST['acf']` | Assuming ACF validation runs there (it does not) |\n| Assets for screens with ACF forms | `acf\u002Finput\u002Fadmin_enqueue_scripts` + `get_current_screen()` check | `admin_enqueue_scripts` on every admin page |\n| Editor behaviour in JS | `acf.addFilter('select2_args')`, `acf.addAction('ready_field\u002Fkey=…')`, `field.val()`, repeater `add()` \u002F `remove($row)` \u002F `$rows()` | Raw DOM edits of ACF markup |\n| Expose field groups and content to AI agents | ACF 6.8 Abilities (`acf\u002Fsettings\u002Fenable_acf_ai`, per-item `allow_ai_access`); see wp-abilities-mcp | Custom REST endpoints that describe fields |\n\nDepth: [references\u002Fsave-flow.md](references\u002Fsave-flow.md) (classic vs block editor sequence), [references\u002Ftraps.md](references\u002Ftraps.md), [references\u002Fdocs.md](references\u002Fdocs.md).\n\n## Verification\n\n- The rule fires where expected: publish in the block editor (validation error on the field), save a draft (no validation), quick edit (only your WordPress-hook guard runs).\n- `node scripts\u002Faudit-native.mjs \u003Capp-path>` shows no new finding without a written reason.\n- `{{runner.wp}} eval 'var_dump(has_filter(\"acf\u002Fvalidate_value\u002Fkey=field_x\"));'` returns a priority, not `false` (the provider booted).\n- Tests, if the project has them, cover the validator class (`{{runner.test}}`).\n\n## Failure modes\n\n| Symptom | Cause | Fix |\n|---|---|---|\n| Validation does not run when saving a draft | ACF's block-editor wrapper validates only when the target status is `publish` or `future`; autosave and preview skip it | Expected; enforce draft rules with a WordPress hook if they really matter |\n| A guard on `wp_insert_post_data` rejects a valid first publish | The block editor sends the REST request first, before the meta-box request carries `$_POST['acf']`; meta is still old | Validate with `acf\u002Fvalidate_value`; react in `acf\u002Fsave_post` > 10; skip the REST request in the guard |\n| `acf\u002Fsave_post` handler reads old values | Priority below 10 | Use priority 20 (or read `$_POST['acf']` deliberately) |\n| Filter on `name=` stops working or fights another plugin\u002Ftheme | Several fields share the name, or other code filters the same name | Use `\u002Fkey=field_…` |\n| Field \"hidden\" with `acf-hidden` still renders | The class alone does not hide | `acf\u002Fprepare_field` returning `false`, or make it code-managed meta |\n| JSON stored with `update_post_meta()` is corrupted | Meta functions unslash the value | `update_post_meta($id, $key, wp_slash($json))` |\n| `acf\u002F*` hooks never fire on `radicle-app` | ACF is not installed | Use `register_post_meta` + `rest_pre_insert_{post_type}` \u002F `wp_insert_post_data` (step 1); add ACF only on request, through the project's registry (wp-composer-plugins) |\n| Renamed ACF Composer group loses data | Field keys derive from group + field names; `_\u003Cname>` reference meta is orphaned | Plan renames with a migration that rewrites the reference meta |\n\n## Escalation\n\n- Hook timing or \"which request runs this hook\": wp-hooks-lifecycle.\n- Creating the field group, block or options page class: acorn-scaffolding.\n- Escaping and sanitising the values on output: wp-security-escaping.\n- The mechanism seems missing in the installed version: check the ACF changelog for the installed version through docs-brain before writing custom code, and tell the user which gap you found.\n\n\u003C!-- verified:\nwp-content\u002Fplugins\u002Fadvanced-custom-fields-pro\u002Fincludes\u002Fvalidation.php:357-360 — validate_value type\u002Fname\u002Fkey\u002Fgeneric filters with ($valid,$value,$field,$input);\nvalidation.php:223 — acf_add_validation_error($input,$message); :257 do_action('acf\u002Fvalidate_save_post'); :38 wp_ajax_acf\u002Fvalidate_save_post;\nincludes\u002Facf-field-functions.php:70,81 — acf\u002Fload_field + type\u002Fname\u002Fkey variations; :568,575 acf\u002Fprepare_field + variations;\nincludes\u002Facf-value-functions.php:146 load_value ($value,$post_id,$field); :200 format_value adds $escape_html; :244 update_value ($value,$post_id,$field,$original);\nincludes\u002Facf-form-functions.php:139-152 — acf_save_post kses-filters $_POST['acf'] for users without unfiltered_html, then do_action('acf\u002Fsave_post'); :180 _acf_do_save_post at default priority 10;\nincludes\u002Fforms\u002Fform-post.php:42 — ACF saves on save_post priority 10;\nincludes\u002Fassets.php:394 — do_action('acf\u002Finput\u002Fadmin_enqueue_scripts');\nassets\u002Fbuild\u002Fjs\u002Facf-input.min.js — savePost wrapper: validates only when status is publish\u002Ffuture, skips isAutosave\u002FisPreview; \"\u003Caction>_field\u002Fkey=\" variations built for ready\u002Fappend\u002Fetc.;\nacf.php:185 — enable_acf_ai default false; src\u002FAI\u002FAI.php:30-46 Abilities only when enabled;\nradicle-app facts checked against a licensed local Radicle project; not reproduced here;\nwp\u002Fwp-includes\u002Frest-api\u002Fendpoints\u002Fclass-wp-rest-posts-controller.php:1531 — rest_pre_insert_{post_type}($prepared_post,$request); :750-754,951-955 a WP_Error from prepare_item_for_database aborts create\u002Fupdate;\nwp\u002Fwp-includes\u002Fpost.php:2812 register_post_meta; meta.php:1449-1450,1512-1525 sanitize_callback\u002Fauth_callback defaults and sanitize_{type}_meta_{key}_for_{subtype} filter; post.php:4978 wp_insert_post_data($data,$postarr,$unsanitized_postarr,$update).\n-->\n",{"name":5,"description":7},"main","4045a2f672c1d4c1b4a5a5712b468c5d73ca6724","plugins\u002Fkivo-wise\u002Fskills\u002Facf-native",0,"https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise","https:\u002F\u002Fhekivo.github.io\u002Fkivo-wise\u002F","https:\u002F\u002Fgithub.com\u002Fhekivo","https:\u002F\u002Fhekivo.dev","2026-11-08 06:10:39",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add hekivo\u002Fkivo-wise --skill acf-native",{"tool":59,"command":60},"bunx","bunx skills add hekivo\u002Fkivo-wise --skill acf-native",{"tool":62,"command":63},"pnpm","pnpm dlx skills add hekivo\u002Fkivo-wise --skill acf-native","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fplugins\u002Fkivo-wise\u002Fskills\u002Facf-native\u002FSKILL.md",true,[67,73,77,81,85,89],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fdocs.md","REFERENCE","参考文档",1450,"https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fplugins\u002Fkivo-wise\u002Fskills\u002Facf-native\u002Freferences\u002Fdocs.md",{"path":74,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fhooks.md",4329,"https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fplugins\u002Fkivo-wise\u002Fskills\u002Facf-native\u002Freferences\u002Fhooks.md",{"path":78,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fjs-api.md",2435,"https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fplugins\u002Fkivo-wise\u002Fskills\u002Facf-native\u002Freferences\u002Fjs-api.md",{"path":82,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fsave-flow.md",2062,"https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fplugins\u002Fkivo-wise\u002Fskills\u002Facf-native\u002Freferences\u002Fsave-flow.md",{"path":86,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Ftraps.md",1939,"https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fplugins\u002Fkivo-wise\u002Fskills\u002Facf-native\u002Freferences\u002Ftraps.md",{"path":90,"resourceType":91,"resourceTypeDesc":92,"sizeBytes":93,"sourceHtmlUrl":94},"scripts\u002Faudit-native.mjs","SCRIPT","脚本",5612,"https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fplugins\u002Fkivo-wise\u002Fskills\u002Facf-native\u002Fscripts\u002Faudit-native.mjs",[96,132,150,170,189,213],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":112,"publishedAt":39},"01M6GKWJDFKQM27HTFXX20QVTP","wp-rest-api","Use when building, extending, or debugging WordPress REST API endpoints\u002Froutes: register_rest_route, WP_REST_Controller\u002Fcontroller classes, schema\u002Fargument validation, permission_callback\u002Fauthentication, response shaping, register_rest_field\u002Fregister_meta, or exposing CPTs\u002Ftaxonomies via show_in_rest.","https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fthird-party\u002Fwp-rest-api\u002FSKILL.md",[102,107],{"categoryNo":103,"categoryName":104,"taxonomyType":105,"taxonomyTypeDesc":106},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":108,"categoryName":109,"taxonomyType":110,"taxonomyTypeDesc":111},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[113,114,115,116,117,118,119,120,121,122,123,124,125,21,126,127,128,129,130,131],"REST","api","wp rest api","rest api","wordpress","workflows","debugging","authentication","Meta","controller","Bash","shaping","filesystem","schema","show","route","register","with","wp-cli",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":140,"publishedAt":39},"01M6GKWEA5BMJZ2RPPEEJTCC3N","wp-abilities-api","Use when working with the WordPress Abilities API (wp_register_ability, wp_register_ability_category, \u002Fwp-json\u002Fwp-abilities\u002Fv1\u002F*, @wordpress\u002Fabilities) including defining abilities, categories, meta, REST exposure, and permissions checks for clients.","https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fthird-party\u002Fwp-abilities-api\u002FSKILL.md",[138,139],{"categoryNo":103,"categoryName":104,"taxonomyType":105,"taxonomyTypeDesc":106},{"categoryNo":108,"categoryName":109,"taxonomyType":110,"taxonomyTypeDesc":111},[114,141,142,117,118,143,121,113,123,144,145,125,146,21,129,147,148,130,149,131],"wp abilities api","cli","permissions","php","json","node","targets","clients","categories",{"skillNo":151,"name":152,"nameZh":6,"description":153,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":156,"publishedAt":39},"01M6GKWA4GG2BZRFXCR9E73VR7","wp-security-escaping","Use when writing or reviewing code that outputs data, handles input or checks permissions in a WordPress + Acorn project - Blade {{ }} vs {!! !!}, esc_html, esc_attr, esc_url, wp_kses_post, \"&#038; in the URL\", double escaping, sanitize_text_field, nonces, current_user_can, map_meta_cap, permission_callback, $wpdb->prepare, whereRaw, file uploads, escaping ACF values, secrets in .env. For route middleware use acorn-routes-api; for ACF validation use acf-native; for Livewire actions use acorn-livewire.","https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fskills\u002Fwp-security-escaping\u002FSKILL.md",[],[29,157,158,159,36,143,160,121,114,161,162,163,164,128,165,166,167,20,168,169],"wp security","wp security escaping","writing","actions","secrets","livewire","text","cap","map","project","middleware","URL","routes-api",{"skillNo":171,"name":172,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":39},"01M6GKW6VVY73BMZ3JNDMR4CWZ","wp-phpstan","Use when configuring, running or fixing PHPStan in a WordPress project that uses Acorn - phpstan.neon, baseline, szepeviktor\u002Fphpstan-wordpress stubs, larastan, level raising, \"Cannot access property on mixed\", get_field() types, paths for app\u002F. For Pint or Mago formatting use testing-wp; for runtime errors use roots-debugging.","https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fskills\u002Fwp-phpstan\u002FSKILL.md",[],[177,178,117,119,179,180,21,166,181,182,183,184,185,186,187,188],"wp phpstan","testing","baseline","access","get","neon","runtime","formatting","app","paths","types","errors",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":195,"publishedAt":39},"01M6GKW3JRSRS9N112QFA3SEGT","wp-performance","Use when a WordPress page, query or request is slow or needs profiling - TTFB, slow or N+1 queries, Query Monitor, Server-Timing, wp profile and wp doctor, autoloaded options, Redis object cache hit rate, transients, WP_CACHE_KEY_SALT. Adds the runner and Redis notes on top of the official procedure. For Eloquent query design use acorn-data; for PHP type errors use wp-phpstan.","https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fskills\u002Fwp-performance\u002FSKILL.md",[],[196,197,198,117,199,200,201,202,203,204,205,206,207,21,208,209,210,211,212,188],"performance","wp performance","design","query design","official","notes","monitor","doctor","cache","server","redis","page","queries","runner","query","type","timing",{"skillNo":214,"name":215,"nameZh":6,"description":216,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":217,"categories":218,"keywords":219,"publishedAt":39},"01M6GKVZN243XQB5QWZ5ZKMG7P","wp-hooks-lifecycle","Use when adding, moving or debugging WordPress actions and filters in an Acorn project - add_action\u002Fadd_filter priority and accepted_args, where a hook belongs (setup or filters files vs a provider boot()), load order (mu-plugins, plugins_loaded, after_setup_theme, init), when Acorn boots per profile, hooks that never fire on Acorn routes, REST or Livewire requests (template_redirect, wp_head), save_post firing twice in the block editor, the_content priorities. For ACF hooks use acf-native; for provider structure use acorn-stack.","https:\u002F\u002Fgithub.com\u002Fhekivo\u002Fkivo-wise\u002Fblob\u002Fmain\u002Fskills\u002Fwp-hooks-lifecycle\u002FSKILL.md",[],[220,221,222,117,223,224,119,160,113,225,162,21,226,227,228,229,230,166,231,232],"lifecycle","hooks","wp hooks lifecycle","init","boot","stack","never","filters","files","provider","structure","filter","theme"]