UTC/local time in Worpdress

your post is very old, but in case someone gets the same issue. Even if your server is set to date_default_timezone_set(‘America/New_york’); When WordPress runs, it rewrite the config to date_default_timezone_set(‘UTC’) to store datetime in UTC, which is the Universal Time without offset. Usually, when I compare a date to now, I use the variable $_SERVER[‘REQUEST_TIME’]. … Read more

Print last modified date only on posts

You can check the post type with get_post_type(). You only want to display the content if the value is post: function wpb_last_updated_date( $content ) { $u_time = get_the_time( ‘U’ ); $u_modified_time = get_the_modified_time( ‘U’ ); if ( get_post_type() === ‘post’ ) { if ( $u_modified_time >= $u_time + 86400) { $updated_date = get_the_modified_time( ‘F jS, … Read more