Hello,
Thanks for contacting us. Sorry for the delay and any inconvenience that might have been caused due to that.
Please paste the code given below in your theme’s/child theme’s functions.php file to remove the datePublished and dateModified from the schema markup:
/*
* Rank Math snippet to remove datePublished & dateModified from WebPage
*
*/
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
unset($data['WebPage']['datePublished']);
unset($data['WebPage']['dateModified']);
return $data;
}, 99, 2);
/*
* Rank Math snippet to remove datePublished & dateModified from Article
*
*/
add_filter( 'rank_math/snippet/rich_snippet_article_entity', function( $data ) {
unset( $data['datePublished'] );
unset( $data['dateModified'] );
return $data;
}, 10, 1 );
Hope this helps. Let us know if you need any further assistance.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.