diff --git a/facebook-commerce-events-tracker.php b/facebook-commerce-events-tracker.php index 17f26e968..8d00fed01 100644 --- a/facebook-commerce-events-tracker.php +++ b/facebook-commerce-events-tracker.php @@ -228,7 +228,7 @@ function ( $post ) { 'custom_data' => array( 'content_name' => $category->name, 'content_category' => $category->name, - 'content_ids' => json_encode( array_slice( $product_ids, 0, 10 ) ), + 'content_ids' => wp_json_encode( array_slice( $product_ids, 0, 10 ) ), 'content_type' => $content_type, 'contents' => $contents, ), @@ -453,7 +453,7 @@ private function get_search_event() { 'event_name' => 'Search', 'custom_data' => array( 'content_type' => $content_type, - 'content_ids' => json_encode( array_slice( $product_ids, 0, 10 ) ), + 'content_ids' => wp_json_encode( array_slice( $product_ids, 0, 10 ) ), 'contents' => $contents, 'search_string' => get_search_query(), 'value' => Helper::number_format( $total_value ), diff --git a/facebook-commerce.php b/facebook-commerce.php index 84b97d340..945ad9be0 100644 --- a/facebook-commerce.php +++ b/facebook-commerce.php @@ -563,7 +563,7 @@ public function ajax_fb_background_check_queue() { 'background' => false, ]; } - printf( json_encode( $response ) ); + printf( wp_json_encode( $response ) ); wp_die(); } @@ -1735,7 +1735,7 @@ public function ajax_check_feed_upload_status() { 'connected' => true, 'status' => 'complete', ]; - printf( json_encode( $response ) ); + printf( wp_json_encode( $response ) ); wp_die(); } @@ -1786,7 +1786,7 @@ public function ajax_check_feed_upload_status_v2() { } else { $response = [ 'connected' => false ]; } - printf( json_encode( $response ) ); + printf( wp_json_encode( $response ) ); wp_die(); } @@ -2015,7 +2015,7 @@ public function get_sample_product_feed() { wp_reset_postdata(); ob_end_clean(); - return json_encode( [ $items ] ); + return wp_json_encode( [ $items ] ); } /** @@ -3009,7 +3009,7 @@ public function ajax_display_test_result() { delete_transient( 'facebook_plugin_test_stack_trace' ); } delete_option( 'fb_test_pass' ); - printf( json_encode( $response ) ); + printf( wp_json_encode( $response ) ); wp_die(); } diff --git a/includes/Handlers/WhatsAppUtilityConnection.php b/includes/Handlers/WhatsAppUtilityConnection.php index 08e0ca90e..02ff60c6b 100644 --- a/includes/Handlers/WhatsAppUtilityConnection.php +++ b/includes/Handlers/WhatsAppUtilityConnection.php @@ -467,7 +467,6 @@ public static function get_supported_languages_for_templates( $integration_confi __( 'Integration Config GET API call Succeeded', 'facebook-for-woocommerce' ) ) ); - // $response_object = json_decode( $data[0] ); wp_send_json_success( $data, 'Finish Integration Config API Call' ); } } diff --git a/includes/fbutils.php b/includes/fbutils.php index 9552014dc..38b0b5e82 100644 --- a/includes/fbutils.php +++ b/includes/fbutils.php @@ -394,7 +394,7 @@ public static function fblog( $obj['plugin_version'] = self::PLUGIN_VERSION; $obj['php_version'] = phpversion(); } - $message = json_encode( + $message = wp_json_encode( array( 'message' => $message, 'object' => $obj, @@ -1020,7 +1020,7 @@ public static function log_with_debug_mode_enabled( $message, $level = null ) { } if ( is_array( $message ) || is_object( $message ) ) { - $message = json_encode( $message ); + $message = wp_json_encode( $message ); } else { $message = sanitize_textarea_field( $message ); }