Closed carolinan closed 1 week ago
I'm guessing that the source of the issue is the same as in #23078.
I've been taking a look today and I am able to reproduce it. After the first look, I believe the issue is caused by this code. I'll keep triaging it and see how it could be solved. The legacy meta box panel is tricky.
I have started this pull request trying to solve this issue. Although I must say that I am not familiar with that code and I am not sure if that's a viable approach.
But if the user preference to show Custom fields is enabled, meaning the meta boxes are open, the meta box field does not update and using the Save button on the post or page does not save the changes to the field.
What do you think about disabling editing for Post Meta block bindings source when Meta Boxes are open? This would essentially resolve the problem, as two-way synchronization would no longer be needed. I also assume that having two places to edit the same metadata for the sites that heavily depend on Meta Boxes isn't that helpful. In effect, when the setting is enabled to use Meta Boxes, then in the post editor Post Meta source would remain in the readonly mode bringing back the experience from WordPress 6.5. It also means that the previewed value won't refresh until the user clicks the Save
button to propagate post meta changes to the server.
What do you think about disabling editing for Post Meta block bindings source when Meta Boxes are open?
This would make sense to me 🙂 Although it is true that other plugins modifying post meta in the store would still face the same issue. This is an example reported a while ago: https://github.com/WordPress/gutenberg/issues/23078
Description
Since https://github.com/WordPress/gutenberg/pull/61753 it is possible to edit the value of a (post meta) binding in a paragraph block or heading by selecting the block and typing. The change is synced across the site when saved.
But if the user preference to show Custom fields is enabled, meaning the meta boxes are open, the meta box field does not update and using the Save button on the post or page does not save the changes to the field. After clicking save and refreshing, the value is not updated.
Step-by-step reproduction instructions
I used the code example from 61753:
function test_block_bindings() { register_meta( 'post', 'text_field', array( 'show_in_rest' => true, 'single' => true, 'type' => 'string', 'default' => 'default text value', ) ); }
Paragraph content