Repository navigation
fix(export): register post meta in PHP export - #544
Open
faisalahammad wants to merge 2 commits into
Open
faisalahammad wants to merge 2 commits into
faisalahammad wants to merge 2 commits into
Conversation
Exported field groups now include register_post_meta() calls for eligible fields, so exported fields work with block bindings in block themes without manual registration. Fixes WordPress#384
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Pass explicit flags to html_entity_decode() so single quote entities decode the same on PHP 7.4 and 8.x. Match the editor preview menu item with a tolerant pattern because WP trunk renamed it to Preview (opens in a new tab). Refs WordPress#544
Author
|
CI fixes for the failing checks: f9fb7ce
The E2E change also fixes the editor preview fixture on trunk for other PRs, since trunk E2E started failing after the label rename. Refs #384 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated PHP now includes
register_post_meta()calls for fields that are eligible, so exported field groups work with block bindings in block themes without manual registration. Previously the export only emittedacf_add_local_field_group()andregister_post_type(), so block bindings reported the field as not registered and it did not show in the bindings picker.Closes #384
What gets registered
A field is exported as post meta only when all of these are true:
post_type == <slug>rule. Groups with mixed or broader rules are skipped rather than guessed.string,boolean,integer,number). Multi value fields such as checkbox, repeater, gallery, or relationship are skipped, since they cannot be registered as single native meta safely.The output is added to the existing export as a separate block:
The existing
acf_add_local_field_group()output is unchanged, so this is additive.Files changed
includes/acf-field-group-functions.php- helper functions to resolve concrete post types from location rules, decide which fields can be registered, and build the exported PHP.includes/admin/tools/class-acf-admin-tool-export.php- prints the post meta block alongside the field group export.tests/php/includes/test-acf-field-group-functions.php- tests for scalar export, multiple post types, skipped fields, and ambiguous locations.How to test
bookpost type.register_post_meta( 'book', ... )call for the field.Testing done
composer test:phppasses: 2947 tests, 22753 assertions.composer lint:phpand the phpcs changed lines check pass on the changed files.Use of AI Tools
This pull request was developed with assistance from GLM 5.3. The tool was used for repository investigation, implementation support, test planning, and review. The final code, tests, and submitted changes were reviewed and verified by the contributor.