-
I’ve been using your code for a while which originally worked, but as of lately all the dates are back on my product page serps. It appears datemodified and datepublished is in the schema again even with the below code…
add_filter( ‘rank_math/snippet/rich_snippet_article_entity’, function( $entity ) {
unset( $entity[‘datePublished’] );
unset( $entity[‘dateModified’] );
return $entity;
} );
add_filter( ‘rank_math/json_ld’, function( $data, $jsonld ) {
if ( ! isset( $data[‘WebPage’] ) ) {
return $data;
}
unset( $data[‘WebPage’][‘datePublished’] );
unset( $data[‘WebPage’][‘dateModified’] );
return $data;
}, 99, 2 );
add_filter( ‘rank_math/opengraph/facebook/og_updated_time’, ‘__return_false’);
add_filter( ‘rank_math/opengraph/facebook/article_published_time’, ‘__return_false’);
add_filter( ‘rank_math/opengraph/facebook/article_modified_time’, ‘__return_false’);
/**
* Filter to remove lastmod from sitemap index
*/
add_filter( ‘rank_math/sitemap/index/entry’, function( $index, $type ) {
if ( isset( $index[‘lastmod’] ) ) {
unset( $index[‘lastmod’] );
}
return $index;
}, 10, 2 );Webpage here: https://www.cobathandbody.com/turmeric-exfoliating-sugar-scrub/
The ticket ‘Removing Datemodified and Datepublished doesn’t work anymore’ is closed to new replies.