- Timestamp:
- 12/12/2018 02:11:22 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43720
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r43979 r43980 1588 1588 } 1589 1589 1590 $post_type_obj = get_post_type_object( $post->post_type ); 1591 if ( is_post_type_viewable( $post_type_obj ) && $post_type_obj->public ) { 1592 1593 if ( ! function_exists( 'get_sample_permalink' ) ) { 1594 require_once ABSPATH . '/wp-admin/includes/post.php'; 1595 } 1596 1597 $sample_permalink = get_sample_permalink( $post->ID, $post->post_title, '' ); 1598 1599 if ( in_array( 'permalink_template', $fields, true ) ) { 1600 $data['permalink_template'] = $sample_permalink[0]; 1601 } 1602 if ( in_array( 'generated_slug', $fields, true ) ) { 1603 $data['generated_slug'] = $sample_permalink[1]; 1604 } 1605 } 1606 1590 1607 $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; 1591 1608 $data = $this->add_additional_fields_to_object( $data, $request ); … … 1919 1936 1920 1937 $post_type_obj = get_post_type_object( $this->post_type ); 1938 if ( is_post_type_viewable( $post_type_obj ) && $post_type_obj->public ) { 1939 $schema['properties']['permalink_template'] = array( 1940 'description' => __( 'Permalink template for the object.' ), 1941 'type' => 'string', 1942 'context' => array( 'edit' ), 1943 'readonly' => true, 1944 ); 1945 1946 $schema['properties']['generated_slug'] = array( 1947 'description' => __( 'Slug automatically generated from the object title.' ), 1948 'type' => 'string', 1949 'context' => array( 'edit' ), 1950 'readonly' => true, 1951 ); 1952 } 1921 1953 1922 1954 if ( $post_type_obj->hierarchical ) {
Note: See TracChangeset
for help on using the changeset viewer.