| 开发者 | silver222 |
|---|---|
| 更新时间 | 2026年8月18日 21:05 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
register_meta() auth callbacks. A user who
cannot edit such a field through core cannot edit it through MetaBench either.
Protected keys — those beginning with an underscore, where ACF, SEO plugins and
WooCommerce keep their data — work differently, and the difference is worth
understanding.
map_meta_cap() denies edit_post_meta on a protected key for every role,
including administrators, unless a plugin has registered an auth_..._meta_...
filter for that specific key. That blanket denial is aimed at untrusted REST and
XML-RPC callers, and it makes the core capability unusable as a gate for a
deliberate administrative tool.
MetaBench therefore gates protected keys separately. They are listed and
editable only when both:
manage_options (filterable via
metabench_protected_capability).wp_localize_script(), so the whole interface translates from a
single .po file with no JavaScript build step and no separate JSON language
packs.
To retranslate or add a locale, edit the .po file in languages/ with Poedit
or any gettext editor, then recompile:
wp i18n make-mo languages/ languages/
wp i18n make-php languages/
After changing translatable strings in the source, regenerate the template with
wp i18n make-pot . languages/metabench.pot --domain=metabench.
For developers
Filters:
metabench_settings — the effective settings array.metabench_required_capability — the capability gating the panel.metabench_protected_capability — the capability gating protected keys.metabench_available_post_types / metabench_available_taxonomies — the
choices offered on the settings screen.metabench_get_items — the rows returned for an object.metabench_validate_key — return a WP_Error to block a write.metabench/v1:
GET /fields/<object_type>/<object_id>POST /fields/<object_type>/<object_id>POST /fields/<object_type>/<object_id>/<meta_id>DELETE /fields/<object_type>/<object_id>/<meta_id>metabench folder to /wp-content/plugins/.No. Each field saves immediately over the REST API, independently of the post. That means you can fix one meta value without publishing unrelated draft edits, but it also means there is no undo — the panel says so beneath the table.
ACF stores its values in protected keys beginning with an underscore. Enable
"Show protected fields" under Settings → MetaBench, and note that only users
with manage_options will see them. Editing those by hand can desynchronise
ACF's own field references, so change them only when you know what a key does.
Either you lack the capability for that key, or the stored value is a serialised PHP object. Objects cannot round-trip through the JSON editor without risking data loss, so MetaBench shows them but refuses to write them.
Yes. Rows are addressed by meta_id, so several rows sharing one key are
listed and edited individually rather than collapsed into one.