WP – How not to show as updated if edited after less than 24 hours

Problem: My WP theme (Golpo) shows both ‘published’ and ‘updated’ dates for posts even if I made a small edit right after publishing. I want a 24 hour grace period.

Solution: Go to Appearance -> Theme Editor and open inc/template-tags.php.

The function golpo_posted_on initially begins with:

function golpo_posted_on() {
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s </time>';
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {

Simply modify the if condition:

function golpo_posted_on() {
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s </time>';
	if ( get_the_time( 'U' ) + 24*60*60 < get_the_modified_time( 'U' ) ) {

Categories: Uncategorized

Tags: , ,