From 5e7c8c695922d645bb5de61508203511a0fa72ab Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Mon, 20 Aug 2018 14:31:06 -0300 Subject: [PATCH] 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). --- includes/class-wc-structured-data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-structured-data.php b/includes/class-wc-structured-data.php index fcd04ff7c46..d78af9244ce 100644 --- a/includes/class-wc-structured-data.php +++ b/includes/class-wc-structured-data.php @@ -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 '';