Archived topic
Apply change to Schema Markup
1 reply · Started by THIAGO on December 9, 2022
Hi, how can I effectively change my article Schema from:
itemtype="https://schema.org/BlogPosting"
to
itemtype="https://schema.org/BlogPosting" itemid="[[CURRENT_LINK]]#richSnippet"
I managed to do it with this function and the following code in my function.php:
add_filter('final_output', function($output) {
$link = get_permalink();
$itemid='itemtype="https://schema.org/BlogPosting" itemid="'.$link.'#richSnippet"';
return str_replace('itemtype="https://schema.org/BlogPosting"', $itemid, $output);
});
It did work, but ended up breaking my pages cache. Any idea of how can I do that in other way?
Hi there,
I'm not sure unfortunately. The theme wouldn't cause an issue like this.
I can't see how the code would be related to the caching though - perhaps you can comment on the post you found and see if the author can comment?