-
We want to remove only datePublished from all places (posts and pages) including this schema script “application/ld+json” class=”rank-math-schema”. We are using the below code but it’s not removing “datePublished” from rank-math-schema. Let us know how to fix this.
add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
unset( $schema['datePublished'] );
return $entity;
});add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
if ( ! isset( $data['WebPage'] ) ) {
return $data;
}
unset( $data['WebPage']['datePublished'] );
return $data;
}, 99, 2 );add_filter( 'rank_math/opengraph/facebook/article_published_time', '__return_false');
The ticket ‘Unable to remove datePublished from rank-math-schema’ is closed to new replies.