How should query abilities expose registered post, term, and user meta?

Aperta
#38 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php, wordpress
Ambito
api, backend

Direzione di ricerca

Read the query ability implementation and the registration and validation paths for post, term, and user meta fields; the issue does not name specific files or tests. Compare how show_in_rest keys are handled by REST requests and query abilities, using the reported cases for fields: ["meta"] and fields: ["meta.audit_visible"] as starting points. The issue asks maintainers to decide whether a separate opt-in is needed, so done requires that policy decision and consistent behavior across all three object types.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When a plugin registers a post, term, or user meta key with show_in_rest, should that also make the key eligible for reads through the corresponding query ability? Or should the plugin opt the key into abilities separately? I'd use the same rule for all three object types, as Grzegorz suggested in #17.

I tested this on single-site WordPress 7.1.5 and 7.2 RC2 with the abilities package at cfbdd91. For each object type, a REST request made as an administrator returned the registered test key and omitted a second key with show_in_rest disabled. With the same user and object, the query ability returned ability_invalid_input for both fields: ["meta"] and fields: ["meta.audit_visible"]. Original test results

The Elementor example on #22 gives this a practical use case. On a builder-managed page, the editable layout lives in post meta, and the builder regenerates post_content on save. A plugin may want to expose a field telling callers who manages that page.

Whichever opt-in we choose, I'd keep reads scoped to the key's registered object type and subtype, and to what the caller may see on that particular object. I'd decide writes separately.

Lingua principale
PHP
Stelle
4
Fork
4
Merge medio
2g 8h
PR unite (30g)
15

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WordPress/abilities

Tutte le issue di WordPress/abilities

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.