diff options
author | Riad Benguella <youknowriad@git.wordpress.org> | 2024-07-23 07:49:54 +0000 |
---|---|---|
committer | Riad Benguella <youknowriad@git.wordpress.org> | 2024-07-23 07:49:54 +0000 |
commit | edfc2b0d89eeff4c5ffdea2fea0946cd00b66bac (patch) | |
tree | d44f81ed2cf1c7a4027a7d73f77ecb502e415929 /tests/phpunit/includes | |
parent | fc33ab699972a6ff1893707f852abd4e15f4dc65 (diff) | |
download | wordpress-edfc2b0d89eeff4c5ffdea2fea0946cd00b66bac.tar.gz wordpress-edfc2b0d89eeff4c5ffdea2fea0946cd00b66bac.zip |
REST API: Remove post status prefix from REST API responses.
When using the /posts or /pages endpoints, for private posts or pages, you get the following title property: { raw: "Some title", rendered: "Private: Some title" }
this commit removes the prefix from rendered private posts titles (just like what we do for protected posts)
Props youknowriad, swissspidy, timothyblynjacobs, sergeybiryukov, ramonopoly.
Fixes #61639.
git-svn-id: https://develop.svn.wordpress.org/trunk@58783 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'tests/phpunit/includes')
-rw-r--r-- | tests/phpunit/includes/testcase-rest-post-type-controller.php | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/phpunit/includes/testcase-rest-post-type-controller.php b/tests/phpunit/includes/testcase-rest-post-type-controller.php index 9b1d366315..75326284e6 100644 --- a/tests/phpunit/includes/testcase-rest-post-type-controller.php +++ b/tests/phpunit/includes/testcase-rest-post-type-controller.php @@ -107,8 +107,10 @@ abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C // Check filtered values. if ( post_type_supports( $post->post_type, 'title' ) ) { add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) ); + add_filter( 'private_title_format', array( $this, 'protected_title_format' ) ); $this->assertSame( get_the_title( $post->ID ), $data['title']['rendered'] ); remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) ); + remove_filter( 'private_title_format', array( $this, 'protected_title_format' ) ); if ( 'edit' === $context ) { $this->assertSame( $post->post_title, $data['title']['raw'] ); } else { |