Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for wp_register_block_metadata_collection to improve performance #404

Open
mogmarsh opened this issue Dec 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@mogmarsh
Copy link
Contributor

mogmarsh commented Dec 6, 2024

Description

see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/

It looks like after running
wp-scripts build
we would also run
wp-scripts build-blocks-manifest

With the manifest file generated, you can now register the block metadata collection as follows:

wp_register_block_metadata_collection(
	WP_PLUGIN_DIR . '/my-block-library/build',
	WP_PLUGIN_DIR . '/my-block-library/build/blocks-manifest.php'
);

Use Case

"Plugins can now optionally register a PHP “manifest” file, which includes all the metadata for their block types. For any block type that is being registered, WordPress Core will now check whether such a manifest file is present covering the block type, and if so, it will use the data from the manifest file instead of reading and parsing the block type’s block.json file directly."

@mogmarsh mogmarsh added the enhancement New feature or request label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant