Skip to content

Instantly share code, notes, and snippets.

@amboutwe
Last active July 27, 2023 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amboutwe/d519504b44802220df2cc29c2172165d to your computer and use it in GitHub Desktop.
Save amboutwe/d519504b44802220df2cc29c2172165d to your computer and use it in GitHub Desktop.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove the datePublished from the Yoast SEO meta tags
* Credit: Yoast team
* Last Tested: Jul 27 2023 using Yoast SEO 20.12 on WordPress 6.2.2
*/
function remove_date_metatags ( $presenters ) {
return array_map( function( $presenter ) {
if ( ! $presenter instanceof Yoast\WP\SEO\Presenters\Open_Graph\Article_Published_Time_Presenter ) {
return $presenter;
}
}, $presenters );
}
add_filter( 'wpseo_frontend_presenters', 'remove_date_metatags', 11, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment