Changeset 43720 for branches/5.0/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
- Timestamp:
- 10/11/2018 10:24:51 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r43716 r43720 1573 1573 $terms = get_the_terms( $post, $taxonomy->name ); 1574 1574 $data[ $base ] = $terms ? array_values( wp_list_pluck( $terms, 'term_id' ) ) : array(); 1575 } 1576 } 1577 1578 $post_type_obj = get_post_type_object( $post->post_type ); 1579 if ( is_post_type_viewable( $post_type_obj ) && $post_type_obj->public ) { 1580 1581 if ( ! function_exists( 'get_sample_permalink' ) ) { 1582 require_once ABSPATH . '/wp-admin/includes/post.php'; 1583 } 1584 1585 $sample_permalink = get_sample_permalink( $post->ID, $post->post_title, '' ); 1586 1587 if ( in_array( 'permalink_template', $fields, true ) ) { 1588 $data['permalink_template'] = $sample_permalink[0]; 1589 } 1590 if ( in_array( 'generated_slug', $fields, true ) ) { 1591 $data['generated_slug'] = $sample_permalink[1]; 1575 1592 } 1576 1593 } … … 1908 1925 1909 1926 $post_type_obj = get_post_type_object( $this->post_type ); 1927 if ( is_post_type_viewable( $post_type_obj ) && $post_type_obj->public ) { 1928 $schema['properties']['permalink_template'] = array( 1929 'description' => __( 'Permalink template for the object.' ), 1930 'type' => 'string', 1931 'context' => array( 'edit' ), 1932 'readonly' => true, 1933 ); 1934 1935 $schema['properties']['generated_slug'] = array( 1936 'description' => __( 'Slug automatically generated from the object title.' ), 1937 'type' => 'string', 1938 'context' => array( 'edit' ), 1939 'readonly' => true, 1940 ); 1941 } 1910 1942 1911 1943 if ( $post_type_obj->hierarchical ) {
Note: See TracChangeset
for help on using the changeset viewer.