[Support request] Post Updated Date

Home Forums Support Post Updated Date

This topic contains 9 replies, has 4 voices, and was last updated by  Leo 7 months, 1 week ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #470419



    I need to show last updated date instead of published date. I did the following but there is some problem.

    .posted-on .updated {
        display: inline-block;
    .posted-on .updated:before {
        content: "Last updated: ";
    time.entry-date.published {
        display: none;

    Above shows updated for the post which was updated but blank which was not updated since published.

    So I am looking for fixes which do the following.

    Show Last updated when post was modified
    Show original published date if post is not updated

    This should also reflect in the source code. Currently, it shows published_time and modified_time both.

    GeneratePress 2.0.1
    GP Premium 1.5.6

    Tom Lead Developer

    If you want to only show the modified date in the source if it’s set, you can scrap that CSS and use this PHP:

    add_filter( 'generate_post_date_output', 'tu_show_modified_date' );
    function tu_show_modified_date() {
    	$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		$time_string = '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
    	$time_string = sprintf( $time_string,
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_attr( get_the_modified_date( 'c' ) ),
    		esc_html( get_the_modified_date() )
    		'<span class="posted-on">%1$s</span>', // WPCS: XSS ok, sanitization ok.
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
    			esc_url( get_permalink() ),
    			esc_attr( get_the_time() ),

    Let me know 🙂



    Hello Tom,

    It’s not working as expected.

    I removed those CSS and added what you mentioned in functions.php file of the child theme.

    I still don’t see last updated time on the blog post. Ex – https://geekflare.com/google-cloud-latency/ this still shows June but post was updated in November.

    Source code still has both times.

    <meta property=”article:published_time” content=”2017-06-15T22:04:32+08:00″ />
    <meta property=”article:modified_time” content=”2017-11-12T14:40:47+08:00″ />

    Please help. As mentioned earlier, I want to show only last updated time on a blog post and source code. However, if post is not updated then show the original published time.


    Tom Lead Developer

    I just adjusted the code a bit to test if it’s working at all – can you update it and let me know?



    It has no affect at all. Still, the same as you can see here – https://geekflare.com/google-cloud-latency/


    Tom Lead Developer

    I think I see the issue – I just adjusted the code above.



    I have been trying to get this updated dates to work on test site.

    I have 2 snippets in place and the CSS you recommended from another post and the meta remains on 2 lines.


    CSS – https://generatepress.com/forums/topic/all-meta-in-one-single-line/#post-108079


    Leo Customer Support

    Hi there,

    Instead of:

    .posted-on .updated {
        display: block;

    Try this:

    .posted-on .updated {
        display: inline-block;

    If this doesn’t help can you open a new topic?




    That worked, Thank you!

    I did notice that the date that shows in WP Show posts and the rest of the site seems different. I will send an email into the support on that plugin since I have a pro version of that also.


    Leo Customer Support
Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.