Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove datePublished markup on BlogPosting https://schema.press/remove-datepublished-markup-posts/
<?php //* do not include php tag
add_filter('schema_output', 'remove_datePublished_markup_588545256');
/**
* Schema Plugin: Remove datePublished markup on BlogPosting
*
* @since 1.0
*/
function remove_datePublished_markup_588545256( $schema ) {
// If markup is for BlogPosting,
// return our $json array and do not do anything
if ( isset($schema['@type']) && $schema['@type'] != 'BlogPosting' ) return $schema;
// Unset the published date
unset( $schema["datePublished"] );
// Unset the modified date (last updated date)
unset( $schema["dateModified"] );
return $schema;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.