diff --git a/src/wp-includes/block-patterns.php b/src/wp-includes/block-patterns.php index e0530c795502c..6e03345e3ba50 100644 --- a/src/wp-includes/block-patterns.php +++ b/src/wp-includes/block-patterns.php @@ -12,7 +12,7 @@ * Registers the core block patterns and categories. * * @since 5.5.0 - * @private + * @access private */ function _register_core_block_patterns_and_categories() { $should_register_core_patterns = get_theme_support( 'core-block-patterns' ); diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php index 44b7631d3c7a1..cd5f09eb8d010 100644 --- a/src/wp-includes/blocks.php +++ b/src/wp-includes/blocks.php @@ -939,9 +939,8 @@ function do_blocks( $content ) { * If do_blocks() needs to remove wpautop() from the `the_content` filter, this re-adds it afterwards, * for subsequent `the_content` usage. * - * @access private - * * @since 5.0.0 + * @access private * * @param string $content The post content running through this filter. * @return string The unmodified content. diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php index a7cd0178b0a42..941aa25f12066 100644 --- a/src/wp-includes/rest-api.php +++ b/src/wp-includes/rest-api.php @@ -337,6 +337,14 @@ function create_initial_rest_routes() { $controller = new WP_REST_Pattern_Directory_Controller(); $controller->register_routes(); + // Block Patterns. + $controller = new WP_REST_Block_Patterns_Controller(); + $controller->register_routes(); + + // Block Pattern Categories. + $controller = new WP_REST_Block_Pattern_Categories_Controller(); + $controller->register_routes(); + // Site Health. $site_health = WP_Site_Health::get_instance(); $controller = new WP_REST_Site_Health_Controller( $site_health ); diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php index 3e44c88f5e6a3..4b3e0f52024b9 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php @@ -22,7 +22,7 @@ class WP_REST_Block_Pattern_Categories_Controller extends WP_REST_Controller { * @since 6.0.0 */ public function __construct() { - $this->namespace = '__experimental'; + $this->namespace = 'wp/v2'; $this->rest_base = 'block-patterns/categories'; } diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php index bcba27fc5e569..0d6241346e677 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php @@ -22,7 +22,7 @@ class WP_REST_Block_Patterns_Controller extends WP_REST_Controller { * @since 6.0.0 */ public function __construct() { - $this->namespace = '__experimental'; + $this->namespace = 'wp/v2'; $this->rest_base = 'block-patterns/patterns'; } diff --git a/src/wp-settings.php b/src/wp-settings.php index 355cb689bbeb1..a396b413ae4c6 100644 --- a/src/wp-settings.php +++ b/src/wp-settings.php @@ -277,6 +277,8 @@ require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-directory-controller.php'; require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php'; require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php'; +require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-patterns-controller.php'; +require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php'; require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-application-passwords-controller.php'; require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-site-health-controller.php'; require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-sidebars-controller.php'; diff --git a/tests/phpunit/tests/rest-api/wpRestBlockPatternCategoriesController.php b/tests/phpunit/tests/rest-api/wpRestBlockPatternCategoriesController.php index 898b519aca546..e9ddd0e554eba 100644 --- a/tests/phpunit/tests/rest-api/wpRestBlockPatternCategoriesController.php +++ b/tests/phpunit/tests/rest-api/wpRestBlockPatternCategoriesController.php @@ -43,7 +43,7 @@ class Tests_REST_WpRestBlockPatternCategoriesController extends WP_Test_REST_Con * * @var string */ - const REQUEST_ROUTE = '/__experimental/block-patterns/categories'; + const REQUEST_ROUTE = '/wp/v2/block-patterns/categories'; /** * Set up class test fixtures. diff --git a/tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php b/tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php index 5bba00115dbe4..f76d44366be2f 100644 --- a/tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php +++ b/tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php @@ -43,7 +43,7 @@ class Tests_REST_WpRestBlockPatternsController extends WP_Test_REST_Controller_T * * @var string */ - const REQUEST_ROUTE = '/__experimental/block-patterns/patterns'; + const REQUEST_ROUTE = '/wp/v2/block-patterns/patterns'; /** * Set up class test fixtures. @@ -100,7 +100,6 @@ public function set_up() { public function test_register_routes() { $routes = rest_get_server()->get_routes(); $this->assertArrayHasKey( static::REQUEST_ROUTE, $routes ); - } public function test_get_items() {