site_oueb_2/wp-includes/blocks/index.php

30 lines
779 B
PHP
Executable File

<?php
/**
* Used to set up all core blocks used with the block editor.
*
* @package WordPress
*/
define( 'BLOCKS_PATH', ABSPATH . WPINC . '/blocks/' );
// 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 types using metadata files.
* Dynamic core blocks are registered separately.
*
* @since 5.5.0
*/
function register_core_block_types_from_metadata() {
$block_folders = require BLOCKS_PATH . 'require-static-blocks.php';
foreach ( $block_folders as $block_folder ) {
register_block_type(
BLOCKS_PATH . $block_folder
);
}
}
add_action( 'init', 'register_core_block_types_from_metadata' );