- Timestamp:
- 07/23/2024 07:49:54 AM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r58706 r58783 1845 1845 if ( rest_is_field_included( 'title.rendered', $fields ) ) { 1846 1846 add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) ); 1847 add_filter( 'private_title_format', array( $this, 'protected_title_format' ) ); 1847 1848 1848 1849 $data['title']['rendered'] = get_the_title( $post->ID ); 1849 1850 1850 1851 remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) ); 1852 remove_filter( 'private_title_format', array( $this, 'protected_title_format' ) ); 1851 1853 } 1852 1854 … … 2048 2050 2049 2051 /** 2050 * Overwrites the default protected title format.2051 * 2052 * By default, WordPress will show password protected posts with a title of2053 * "Protected: %s" , as the REST API communicates the protectedstatus of a post2054 * in a machine-readable format, we remove the "Protected: "prefix.2055 * 2056 * @since 4.7.0 2057 * 2058 * @return string Protected title format.2052 * Overwrites the default protected and private title format. 2053 * 2054 * By default, WordPress will show password protected or private posts with a title of 2055 * "Protected: %s" or "Private: %s", as the REST API communicates the status of a post 2056 * in a machine-readable format, we remove the prefix. 2057 * 2058 * @since 4.7.0 2059 * 2060 * @return string Title format. 2059 2061 */ 2060 2062 public function protected_title_format() {
Note: See TracChangeset
for help on using the changeset viewer.