Skip to content

Instantly share code, notes, and snippets.

@schilke
Created April 28, 2015 08:21
Show Gist options
  • Save schilke/e0bb2b7da64c18e663eb to your computer and use it in GitHub Desktop.
Save schilke/e0bb2b7da64c18e663eb to your computer and use it in GitHub Desktop.
Remove Date/Time information from Postinfo to avoid showing up in SERPs
<?php
/****************************************************************************************************************
* ATTENTION! Don't copy the above line if you're going to use this in your functions.php - just the code below *
****************************************************************************************************************/
function jsc_remove_modified_date(){
if( is_page() ){
add_filter( 'the_time', '__return_false' );
add_filter( 'the_modified_time', '__return_false' );
add_filter( 'get_the_modified_time', '__return_false' );
add_filter( 'the_date', '__return_false' );
add_filter( 'the_modified_date', '__return_false' );
add_filter( 'get_the_modified_date', '__return_false' );
}
}
add_action( 'template_redirect', 'jsc_remove_modified_date' );
/****************************************************************************************************************
* ATTENTION! Don't copy the below line if you're going to use this in your functions.php - just the code above *
****************************************************************************************************************/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment