Incorrectly formatted JSON
-
The plugin injects a JSON object in the page head that can be an incorrectly formatted JSON object if the post content includes the ” character. To fix this I added a str_replace call on line 44 of /app/services/review-schema.php to replace all occurrences of the ” character with \”.
$schema_reviews = '{ "@context": "https://schema.org", "@type": "Product", "aggregateRating": { "@type": "AggregateRating", "ratingValue": "' . $get_overall_ratings_score . '", "reviewCount": "' . $post->comment_count . '" }, "description": "' . str_replace('"', '\"', $post->post_content) . '", "name": "' . $post->post_title . '", "image": "' . $args['featured_image_url'] . '" }';
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Incorrectly formatted JSON’ is closed to new replies.