index.php 779 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * Used to set up all core blocks used with the block editor.
  4. *
  5. * @package WordPress
  6. */
  7. define( 'BLOCKS_PATH', ABSPATH . WPINC . '/blocks/' );
  8. // Include files required for core blocks registration.
  9. require BLOCKS_PATH . 'legacy-widget.php';
  10. require BLOCKS_PATH . 'widget-group.php';
  11. require BLOCKS_PATH . 'require-dynamic-blocks.php';
  12. /**
  13. * Registers core block types using metadata files.
  14. * Dynamic core blocks are registered separately.
  15. *
  16. * @since 5.5.0
  17. */
  18. function register_core_block_types_from_metadata() {
  19. $block_folders = require BLOCKS_PATH . 'require-static-blocks.php';
  20. foreach ( $block_folders as $block_folder ) {
  21. register_block_type(
  22. BLOCKS_PATH . $block_folder
  23. );
  24. }
  25. }
  26. add_action( 'init', 'register_core_block_types_from_metadata' );