From 48a1d59284fbb3d085e11ec41c6c82a20b059d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Maneiro?= <583546+oandregal@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:47:41 +0100 Subject: [PATCH] Declare orderby_hierarchy in post controller test --- .../rest-api/endpoints/class-wp-rest-posts-controller.php | 4 +++- tests/phpunit/tests/rest-api/rest-pages-controller.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index aa53a4fa2a6fe..b9025b511481d 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -3007,8 +3007,10 @@ public function get_collection_params() { ), 'default' => array(), ); + } + if ( $post_type->hierarchical ) { $query_params['orderby_hierarchy'] = array( - 'description' => 'Sort pages by hierarchy.', + 'description' => __( 'Whether the post should be grouped by parent-child relationship (hierarchy).' ), 'type' => 'boolean', 'default' => false, ); diff --git a/tests/phpunit/tests/rest-api/rest-pages-controller.php b/tests/phpunit/tests/rest-api/rest-pages-controller.php index 9717a7fcda1c6..37478a1ec850c 100644 --- a/tests/phpunit/tests/rest-api/rest-pages-controller.php +++ b/tests/phpunit/tests/rest-api/rest-pages-controller.php @@ -79,6 +79,7 @@ public function test_registered_query_params() { 'offset', 'order', 'orderby', + 'orderby_hierarchy', 'page', 'parent', 'parent_exclude',