Changeset 49299
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
r48782 r49299 1160 1160 1161 1161 if ( 0 !== (int) $comment->comment_post_ID ) { 1162 $post = get_post( $comment->comment_post_ID ); 1163 1164 if ( ! empty( $post->ID ) ) { 1165 $obj = get_post_type_object( $post->post_type ); 1166 $base = ! empty( $obj->rest_base ) ? $obj->rest_base : $obj->name; 1167 1162 $post = get_post( $comment->comment_post_ID ); 1163 $post_route = rest_get_route_for_post( $post ); 1164 1165 if ( ! empty( $post->ID ) && $post_route ) { 1168 1166 $links['up'] = array( 1169 'href' => rest_url( 'wp/v2/' . $base . '/' . $comment->comment_post_ID),1167 'href' => rest_url( $post_route ), 1170 1168 'embeddable' => true, 1171 1169 'post_type' => $post->post_type, -
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r49051 r49299 3255 3255 ); 3256 3256 3257 if ( $comment->comment_post_ID ) { 3258 $this->assertEquals( rest_url( '/wp/v2/posts/' . $comment->comment_post_ID ), $links['up'][0]['href'] ); 3259 } 3260 3257 3261 if ( 'edit' === $context ) { 3258 3262 $this->assertSame( $comment->comment_author_email, $data['author_email'] );
Note: See TracChangeset
for help on using the changeset viewer.