Last active
January 24, 2019 20:24
-
-
Save schemapress/752097d54d4e88171fb0cbd8ac520f4e to your computer and use it in GitHub Desktop.
Remove datePublished markup on BlogPosting https://schema.press/remove-datepublished-markup-posts/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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