V3 block default field values not saved on first save when only InnerBlocks are edited (autoInlineEditing: true) — regression since 6.6.2 fix
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- full-stack
Direzione di ricerca
Riproduci il problema con i file mostrati block.json e my-block.php e con un gruppo di campi esportato contenente il valore predefinito del layout. Inizia confrontando gli attributi del blocco e il contenuto serializzato al primo salvataggio quando cambia solo InnerBlocks, incluso lo stato del pulsante di salvataggio di Gutenberg. Il lavoro è completato quando i valori predefiniti persistono al primo salvataggio per ogni istanza del blocco e il pulsante di salvataggio rimane disabilitato dopo il salvataggio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
ACF V3 blocks with autoInlineEditing: true do not commit field default_value to block attrs on first save, unless the user explicitly interacts with an ACF field before saving. The ACF 6.6.2 changelog states this was fixed ("V3 Blocks now save default field values even if the block wasn't interacted with before saving"), but the fix does not apply when only InnerBlocks are edited.
Additionally, after saving a page containing such a block for the first time, the Gutenberg save button re-activates — suggesting ACF is modifying post_content server-side after the save, causing the editor to detect a content mismatch. When two or more instances of the same block are on the same page, only the last one has defaults correctly applied after the second save.
To Reproduce
Register a V3 ACF block with autoInlineEditing: true containing a select field with a default_value and an InnerBlocks area.
Insert the block on a page. The ACF field shows the default value in the editor sidebar (client-side only — expected).
Edit one of the block's InnerBlocks (e.g. type in the paragraph) or do not edit anything at all. Do not touch the ACF select field.
Click Save.
Reload the page in the editor.
Inspect the block — the ACF field is empty in the DB; default_value was not committed.
Expected behavior
The default_value for each field should be committed to block attrs on the first save, consistent with the fix described in the 6.6.2 changelog. The save button should remain disabled after saving with no server-side content mismatch.
Code
block.json:
{
"name": "acf/my-block",
"title": "My Block",
"acf": {
"blockVersion": 3,
"autoInlineEditing": true,
"usePostMeta": false,
"renderTemplate": "my-block.php"
},
"apiVersion": 3
}
my-block.php:
<?php
$layout = get_field( 'layout' ) ?: 'left';
?>
<div class="my-block" data-layout="<?php echo esc_attr( $layout ); ?>">
<InnerBlocks />
</div>
Field group JSON: (drag and drop the exported field group containing the layout select field with default_value: "left", allow_null: 0, assigned to acf/my-block)
Version Information:
WordPress Version: 7.0
PHP Version: 8.5.6
ACF Version: ACF PRO 6.8.1
Browser: Firefox 151.0.1
Additional context
Confirmed on a clean WordPress install with no plugins except ACF PRO 6.8.1. Custom theme hooks were ruled out by testing on a bare theme.
The save button re-activation suggests ACF's server-side processing modifies the serialized block comment after save, causing Gutenberg to detect a mismatch between what the editor sent and what the server returned.
The bug appears specific to autoInlineEditing: true — worth verifying whether the 6.6.2 fix only covers blocks without inline editing.
- Lingua principale
- PHP
- Stelle
- 948
- Fork
- 198
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AdvancedCustomFields/acf
-
PHP 8.5: "Using null as an array offset" deprecation in ACF_Data::is() when rendering a block with empty data (local-meta.php is_request)Forse già presa @faisalahammad l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
AdvancedCustomFields/acf#1044 ·
-
is_preview was called incorrectly notice on every early get_field() since 6.8.10 (acf_revisions::acf_validate_post_id)Forse già presa @faisalahammad l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AdvancedCustomFields/acf#1041 · 1 commento ·
-
True / False ACF control bug on RTL layoutsForse già presa @elicohenator l’ha presa 31 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
AdvancedCustomFields/acf#1038 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AdvancedCustomFields/acf#1034 · 3 commenti ·
-
Bug: class-acf-field-icon_picker.php calls wp_get_attachment_image_url() with string Dashicon slug, causing fatal TypeError on PHP 8+Forse già presa @antwonw l’ha presa 43 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
AdvancedCustomFields/acf#1032 · 1 commento ·
Tutte le issue di AdvancedCustomFields/acf
Issue simili
-
0.kind: enhancement 9.needs: package (update)
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
NixOS/nixpkgs#577156 · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
tine-groupware/tine#277 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
MagnaCapax/PMSS#1142 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Native-arrow select renders a second Jetpack chevronForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Automattic/static-site-importer#2294 ·
I maintainer di solito rispondono entro 1 giorno
-
bug 🐛
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
netalertx/NetAlertX#1856 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno