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/tests/rest-api/wpRestMenuItemsController.php

    r58065 r58783  
    863863        if ( post_type_supports( self::POST_TYPE, 'title' ) ) {
    864864            add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
     865            add_filter( 'private_title_format', array( $this, 'protected_title_format' ) );
    865866            $this->assertSame( $post->title, $data['title']['rendered'] );
    866867            remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
     868            remove_filter( 'private_title_format', array( $this, 'protected_title_format' ) );
    867869            if ( 'edit' === $context ) {
    868870                $this->assertSame( $post->title, $data['title']['raw'] );
Note: See TracChangeset for help on using the changeset viewer.