public function write_json($content)
{
$json = apply_filters('apple_news_write_json', $content, $this->content_id);
// JSON should be decoded before being stored.
// Otherwise, stripslashes_deep could potentially remove valid characters
// such as newlines (\n).s
$decoded_json = json_decode(sanitize_text_field($json));
if (null === $decoded_json) {
// This is invalid JSON.
// Store as an empty string.
$decoded_json = '';
}
update_post_meta($this->content_id, self::JSON_META_KEY, $decoded_json);
}