// Include files required for core blocks registration. require BLOCKS_PATH . 'legacy-widget.php'; require BLOCKS_PATH . 'widget-group.php'; require BLOCKS_PATH . 'require-dynamic-blocks.php';
/** * Registers core block style handles. * * While {@see register_block_style_handle()} is typically used for that, the way it is * implemented is inefficient for core block styles. Registering those style handles here * avoids unnecessary logic and filesystem lookups in the other function. * * @since 6.3.0 */ function register_core_block_style_handles() { $wp_version = wp_get_wp_version();
if ( ! wp_should_load_separate_core_block_assets() ) { return; }
/* * Ignore transient cache when the development mode is set to 'core'. Why? To avoid interfering with * the core developer's workflow. */ $can_use_cached = ! wp_is_development_mode( 'core' );
if ( $can_use_cached ) { $cached_files = get_transient( $transient_name );
// Check the validity of cached values by checking against the current WordPress version. if ( is_array( $cached_files ) && isset( $cached_files['version'] ) && $cached_files['version'] === $wp_version && isset( $cached_files['files'] ) ) { $files = $cached_files['files']; } }
// Save core block style paths in cache when not in development mode. if ( $can_use_cached ) { set_transient( $transient_name, array( 'version' => $wp_version, 'files' => $files, ) ); } }
/** * Registers the core block metadata collection. * * This function is hooked into the 'init' action with a priority of 9, * ensuring that the core block metadata is registered before the regular * block initialization that happens at priority 10. * * @since 6.7.0 */ function wp_register_core_block_metadata_collection() { wp_register_block_metadata_collection( BLOCKS_PATH, BLOCKS_PATH . 'blocks-json.php' ); } add_action( 'init', 'wp_register_core_block_metadata_collection', 9 );