Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

V3 block default field values not saved on first save when only InnerBlocks are edited (autoInlineEditing: true) — regression since 6.6.2 fix

Đang mở
#1,013 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
full-stack

Hướng nghiên cứu

Tái hiện vấn đề với các tệp block.json và my-block.php được hiển thị, cùng một nhóm trường đã xuất có chứa giá trị mặc định của layout. Bắt đầu bằng cách so sánh các thuộc tính block và nội dung đã tuần tự hóa ở lần lưu đầu tiên khi chỉ InnerBlocks thay đổi, bao gồm cả trạng thái của nút lưu Gutenberg. Được coi là hoàn tất khi các giá trị mặc định vẫn được giữ lại ngay trong lần lưu đầu tiên cho mọi instance của block và nút lưu vẫn bị vô hiệu hóa sau khi lưu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
PHP
Star
947
Fork
198
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AdvancedCustomFields/acf

Tất cả issue của AdvancedCustomFields/acf

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.