-
This ticket is a follow up to ticket #939823 & #951001
The intial ticket solved the issue of datePublished and dateModified from my product pages.
The second ticket solved the issue of datePublished appearing whenever a customer left a review.However, even with both of those solved, Google still fetches a date from somewhere.
I have attached an example image, the issue does not appear for any of my competitors.Example here:
https://imgur.com/a/zBsJGwFThere’s no datePublished anywhere when inspecting the URL, but Google is still adding the published date to the search results.
The current code looks like this:
add_filter( ‘rank_math/json_ld’, function( $data, $jsonld ) {
if ( is_product() ) {
// Remove dateModified and datePublished from WebPage
unset( $data[‘WebPage’][‘dateModified’] );
unset( $data[‘WebPage’][‘datePublished’] );
}
return $data;
}, 9999, 2 );add_filter( ‘rank_math/snippet/rich_snippet_product_entity’, function( $entity ) {
// Remove datePublished from the main entity
unset( $entity[‘datePublished’] );// Remove datePublished from each review if it exists
if ( isset( $entity[‘review’] ) ) {
foreach ( $entity[‘review’] as $k => $rr ) {
unset( $entity[‘review’][$k][‘datePublished’] );
}
}
return $entity;
});
The ticket ‘Unable to Remove Date Snippets from Search Results (cont. pt.2)’ is closed to new replies.