Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- **`readonly` and `disabled` are now valid on the field types that render
them.** ACF Pro passes both into the rendered input for `text`, `textarea`,
`number`, `range`, `email`, `url`, `password`, `select`, `date_picker`,
`date_time_picker` and `time_picker`, but no schema declared either key and
`field-item.schema.json` sets `unevaluatedProperties: false` — so a field
group using ACF's own read-only inputs failed validation, with no local
ignore to fall back on. Grounded in
`includes/fields/class-acf-field-text.php:71` (which `password` reaches via
`class-acf-field-password.php:52`, delegating its whole render to `text`),
`class-acf-field-select.php:283`, and the `$keys2` list each remaining type
passes to `acf_esc_attrs()`. Added per type rather than to the base field
schema: ACF ignores both on `image`, `repeater`, `true_false` and the rest,
and accepting them there would let dead configuration ship silently. Found
downstream on `fellows`, whose `flat` group marks two import-owned fields
read-only.
Note for future ACF upgrades: this is a per-type list and it will need
re-checking when ACF changes which types render these attributes.

## [0.7.5] - 2026-08-12

### Fixed
Expand Down
4 changes: 3 additions & 1 deletion schemas/refs/field-date_picker.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"display_format": { "type": "string" },
"return_format": { "type": "string" },
"first_day": { "type": ["integer", "string"] }
"first_day": { "type": ["integer", "string"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion schemas/refs/field-date_time_picker.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"display_format": { "type": "string" },
"return_format": { "type": "string" },
"first_day": { "type": ["integer", "string"] }
"first_day": { "type": ["integer", "string"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
6 changes: 5 additions & 1 deletion schemas/refs/field-email.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.parisek.dev/acf/refs/field-email.schema.json",
"title": "ACF Field — Email",
"type": "object"
"type": "object",
"properties": {
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion schemas/refs/field-number.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"min": { "type": ["number", "string", "null"], "description": "ACF stores an unset bound as an empty string." },
"max": { "type": ["number", "string", "null"] },
"step": { "type": ["number", "string", "null"] }
"step": { "type": ["number", "string", "null"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
6 changes: 5 additions & 1 deletion schemas/refs/field-password.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.parisek.dev/acf/refs/field-password.schema.json",
"title": "ACF Field — Password",
"type": "object"
"type": "object",
"properties": {
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion schemas/refs/field-range.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"min": { "type": ["number", "string", "null"], "description": "ACF stores an unset bound as an empty string." },
"max": { "type": ["number", "string", "null"] },
"step": { "type": ["number", "string", "null"] }
"step": { "type": ["number", "string", "null"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion schemas/refs/field-select.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"return_format": { "enum": ["value", "label", "array"] },
"placeholder": { "type": "string" },
"create_options": { "enum": [0, 1], "description": "Allow editors to create new option values." },
"save_options": { "enum": [0, 1], "description": "Save newly created options to choices." }
"save_options": { "enum": [0, 1], "description": "Save newly created options to choices." },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion schemas/refs/field-text.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"title": "ACF Field — Text",
"type": "object",
"properties": {
"maxlength": { "type": ["string", "integer", "null"] }
"maxlength": { "type": ["string", "integer", "null"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion schemas/refs/field-textarea.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"maxlength": { "type": ["string", "integer", "null"] },
"rows": { "type": ["string", "integer", "null"] },
"new_lines": { "enum": ["wpautop", "br", ""] }
"new_lines": { "enum": ["wpautop", "br", ""] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion schemas/refs/field-time_picker.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"type": "object",
"properties": {
"display_format": { "type": "string" },
"return_format": { "type": "string" }
"return_format": { "type": "string" },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
6 changes: 5 additions & 1 deletion schemas/refs/field-url.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.parisek.dev/acf/refs/field-url.schema.json",
"title": "ACF Field — URL",
"type": "object"
"type": "object",
"properties": {
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion src/templates/refs/field-date_picker.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"display_format": { "type": "string" },
"return_format": { "type": "string" },
"first_day": { "type": ["integer", "string"] }
"first_day": { "type": ["integer", "string"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion src/templates/refs/field-date_time_picker.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"display_format": { "type": "string" },
"return_format": { "type": "string" },
"first_day": { "type": ["integer", "string"] }
"first_day": { "type": ["integer", "string"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
6 changes: 5 additions & 1 deletion src/templates/refs/field-email.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.parisek.dev/acf/refs/field-email.schema.json",
"title": "ACF Field — Email",
"type": "object"
"type": "object",
"properties": {
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion src/templates/refs/field-number.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"min": { "type": ["number", "string", "null"], "description": "ACF stores an unset bound as an empty string." },
"max": { "type": ["number", "string", "null"] },
"step": { "type": ["number", "string", "null"] }
"step": { "type": ["number", "string", "null"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
6 changes: 5 additions & 1 deletion src/templates/refs/field-password.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.parisek.dev/acf/refs/field-password.schema.json",
"title": "ACF Field — Password",
"type": "object"
"type": "object",
"properties": {
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion src/templates/refs/field-range.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"min": { "type": ["number", "string", "null"], "description": "ACF stores an unset bound as an empty string." },
"max": { "type": ["number", "string", "null"] },
"step": { "type": ["number", "string", "null"] }
"step": { "type": ["number", "string", "null"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion src/templates/refs/field-select.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"return_format": { "enum": ["value", "label", "array"] },
"placeholder": { "type": "string" },
"create_options": { "enum": [0, 1], "description": "Allow editors to create new option values." },
"save_options": { "enum": [0, 1], "description": "Save newly created options to choices." }
"save_options": { "enum": [0, 1], "description": "Save newly created options to choices." },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion src/templates/refs/field-text.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"title": "ACF Field — Text",
"type": "object",
"properties": {
"maxlength": { "type": ["string", "integer", "null"] }
"maxlength": { "type": ["string", "integer", "null"] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion src/templates/refs/field-textarea.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"properties": {
"maxlength": { "type": ["string", "integer", "null"] },
"rows": { "type": ["string", "integer", "null"] },
"new_lines": { "enum": ["wpautop", "br", ""] }
"new_lines": { "enum": ["wpautop", "br", ""] },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
4 changes: 3 additions & 1 deletion src/templates/refs/field-time_picker.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"type": "object",
"properties": {
"display_format": { "type": "string" },
"return_format": { "type": "string" }
"return_format": { "type": "string" },
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
6 changes: 5 additions & 1 deletion src/templates/refs/field-url.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.parisek.dev/acf/refs/field-url.schema.json",
"title": "ACF Field — URL",
"type": "object"
"type": "object",
"properties": {
"readonly": { "enum": [0, 1], "description": "ACF renders this into the input's readonly attribute." },
"disabled": { "enum": [0, 1], "description": "ACF renders this into the input's disabled attribute." }
}
}
29 changes: 29 additions & 0 deletions tests/fixtures/invalid/image-readonly-prop/acf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"key": "group_test_readonly_on_image",
"title": "Test: readonly on an image field (forbidden)",
"fields": [
{
"key": "field_test_image_readonly",
"label": "Image",
"name": "image",
"type": "image",
"allow_in_bindings": 0,
"return_format": "array",
"readonly": 1,
"wpml_cf_preferences": 1
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
]
],
"menu_order": 0,
"active": true,
"modified": 1716000000,
"acfml_field_group_mode": "advanced"
}
5 changes: 5 additions & 0 deletions tests/fixtures/invalid/image-readonly-prop/assert.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"description": "readonly and disabled are accepted only on the field types whose ACF render method passes them into the input (text, textarea, number, range, email, url, select, date_picker, date_time_picker, time_picker). ACF ignores them on an image field, so accepting the key here would let dead configuration ship silently.",
"schema": "https://schemas.parisek.dev/acf/acf.schema.json",
"min_violations": 1
}
Loading