Make WordPress Core


Ignore:
Timestamp:
10/24/2020 01:18:50 PM (4 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Support generating comment up links to custom posts controllers.

The comments controller now uses the rest_get_route_for_post function introduced in WordPress 5.5 to generate the link. This function is filterable to allow for custom controllers to properly define their REST API route.

Props dsifford, TimothyBlynJacobs.
Fixes #44152.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php

    r49051 r49299  
    32553255        );
    32563256
     3257        if ( $comment->comment_post_ID ) {
     3258            $this->assertEquals( rest_url( '/wp/v2/posts/' . $comment->comment_post_ID ), $links['up'][0]['href'] );
     3259        }
     3260
    32573261        if ( 'edit' === $context ) {
    32583262            $this->assertSame( $comment->comment_author_email, $data['author_email'] );
Note: See TracChangeset for help on using the changeset viewer.