Make WordPress Core


Ignore:
Timestamp:
07/23/2024 07:49:54 AM (10 months ago)
Author:
youknowriad
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-rest-post-type-controller.php

    r57603 r58783  
    108108        if ( post_type_supports( $post->post_type, 'title' ) ) {
    109109            add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
     110            add_filter( 'private_title_format', array( $this, 'protected_title_format' ) );
    110111            $this->assertSame( get_the_title( $post->ID ), $data['title']['rendered'] );
    111112            remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
     113            remove_filter( 'private_title_format', array( $this, 'protected_title_format' ) );
    112114            if ( 'edit' === $context ) {
    113115                $this->assertSame( $post->post_title, $data['title']['raw'] );
Note: See TracChangeset for help on using the changeset viewer.