Skip to content

Commit

Permalink
use rest_get_route_for_post
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Aug 25, 2024
1 parent 159c541 commit 7278d79
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public function sideload_item( WP_REST_Request $request ) {

$response_request = new WP_REST_Request(
WP_REST_Server::READABLE,
rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $attachment_id ) )
rest_url( rest_get_route_for_post( $attachment_id ) )
);

$response_request->set_param( 'context', 'edit' );
Expand All @@ -343,7 +343,7 @@ public function sideload_item( WP_REST_Request $request ) {

$response = $this->prepare_item_for_response( get_post( $attachment_id ), $response_request );

$response->header( 'Location', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $attachment_id ) ) );
$response->header( 'Location', rest_url( rest_get_route_for_post( $attachment_id ) ) );

return $response;
}
Expand Down

0 comments on commit 7278d79

Please sign in to comment.