Improved links
This commit is contained in:
parent
7d07d52279
commit
1137782c6a
|
@ -432,11 +432,21 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller {
|
||||||
'collection' => array(
|
'collection' => array(
|
||||||
'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ),
|
'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ),
|
||||||
),
|
),
|
||||||
'product' => array(
|
|
||||||
'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $review->comment_post_ID ) ),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( 0 !== (int) $review->comment_post_ID ) {
|
||||||
|
$links['up'] = array(
|
||||||
|
'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $review->comment_post_ID ) ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 0 !== (int) $review->user_id ) {
|
||||||
|
$links['reviewer'] = array(
|
||||||
|
'href' => rest_url( 'wp/v2/users/' . $review->user_id ),
|
||||||
|
'embeddable' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $links;
|
return $links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue