Skip to content

Commit

Permalink
Decode HTML entities from REST exception for conversion to WP_Error.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Oct 3, 2024
1 parent 0d785de commit b5ffdaa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/REST_Routes/Abstract_REST_Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ abstract protected function global_args(): array;
private function rest_exception_to_wp_error( REST_Exception $e ) {
return new WP_Error(
$e->get_error_code(),
$e->getMessage(),
// Decode escaped HTML entities from the exception.
html_entity_decode( $e->getMessage(), ENT_QUOTES, get_bloginfo( 'charset' ) ),
array( 'status' => $e->get_response_code() )
);
}
Expand Down

0 comments on commit b5ffdaa

Please sign in to comment.