- Timestamp:
- 07/31/2019 07:59:30 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r45590 r45705 1614 1614 $post_type_obj = get_post_type_object( $post->post_type ); 1615 1615 if ( is_post_type_viewable( $post_type_obj ) && $post_type_obj->public ) { 1616 1617 if ( ! function_exists( 'get_sample_permalink' ) ) { 1618 require_once ABSPATH . 'wp-admin/includes/post.php'; 1619 } 1620 1621 $sample_permalink = get_sample_permalink( $post->ID, $post->post_title, '' ); 1622 1623 if ( in_array( 'permalink_template', $fields, true ) ) { 1624 $data['permalink_template'] = $sample_permalink[0]; 1625 } 1626 if ( in_array( 'generated_slug', $fields, true ) ) { 1627 $data['generated_slug'] = $sample_permalink[1]; 1616 $permalink_template_requested = in_array( 'permalink_template', $fields, true ); 1617 $generated_slug_requested = in_array( 'generated_slug', $fields, true ); 1618 1619 if ( $permalink_template_requested || $generated_slug_requested ) { 1620 if ( ! function_exists( 'get_sample_permalink' ) ) { 1621 require_once ABSPATH . 'wp-admin/includes/post.php'; 1622 } 1623 1624 $sample_permalink = get_sample_permalink( $post->ID, $post->post_title, '' ); 1625 1626 if ( $permalink_template_requested ) { 1627 $data['permalink_template'] = $sample_permalink[0]; 1628 } 1629 1630 if ( $generated_slug_requested ) { 1631 $data['generated_slug'] = $sample_permalink[1]; 1632 } 1628 1633 } 1629 1634 }
Note: See TracChangeset
for help on using the changeset viewer.