Remove unneeded call to wc_clean() when outputting product structured data

This commit removes an unneeded call to wc_clean() before outputting product structured data to the browser. wp_json_encode() is called before the data is sent to the browser and it should be enough to escape it. wc_clean(), which calls sanitize_text_field() internally, was causing issues with the product URL when its name contained some non-ASCII characters (see #21057 for examples of characters).
This commit is contained in:
Rodrigo Primo 2018-08-20 14:31:06 -03:00
parent 735162eb2a
commit 5e7c8c6959
1 changed files with 1 additions and 1 deletions

View File

@ -150,7 +150,7 @@ class WC_Structured_Data {
*/
public function output_structured_data() {
$types = $this->get_data_type_for_page();
$data = wc_clean( $this->get_structured_data( $types ) );
$data = $this->get_structured_data( $types );
if ( $data ) {
echo '<script type="application/ld+json">' . wp_json_encode( $data ) . '</script>';