Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

Display the Last Updated Date of Your Posts in WordPress

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
Display the Last Updated Date of Your Posts in WordPress

WordPress is being used for many purposes. Some are for blogs, whereas others are news sites. When you pubilsh a news story, there are often times you might need to make updates. In this tutorial we will share how you can let your users know that the post was updated. We will highlight how to display the last updated date of your posts.

For example, if you posted an article on July 19, 2009, and you found out three days later that there was an update to the story. You can just edit the article, and it will show July 22, 2009 at the timestamp for last update.

First you need to open these three files:

  1. index.php
  2. single.php
  3. page.php

Then you will need to locate the following code:

<?php the_modified_time('F jS, Y');?>

Note: Since there are so many formats of displaying dates, you might not see the exact code, but something along this line.

Replace it with:

<?php $u_time = get_the_time('U'); 
$u_modified_time = get_the_modified_time('U'); 
if ($u_modified_time >= $u_time + 86400) { 
echo "and last modified on "; 
the_modified_time('F jS, Y'); 
echo " at "; 
echo ", "; } ?>

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Karan says:

    Hello WPBeginner Team,

    Can you please state your SEO point of view about displaying last updated date instead of published date?
    I have just successfully applied the changes and my blog posts are showing last updated date.

    What would be your opinion? Is it better to show last updated rather than published?

    Thank You,

  2. Hardhik says:

    Hi Buddy,
    If I am not wrong, I have to replace this code in index, single and page.php pages.

  3. Amar says:

    Hello sir ,

    I wanna know that is there any way to find out when a article was published first time ??

    • WPBeginner Support says:

      Most sites show the publish date instead of last updated date. However, if a site does not show it, then you can still try viewing the source code. They may or not have a meta tag for published date and time.

  4. ld says:

    Can you recommend a plugin that accomplishes this?

    Also, if I simply type “Last updated on XXXX”, will search engines recognize this and give appropriate credit for the freshness of the content?

  5. Milt Klingsporn says:

    The plugin “Last Modified Timestamp” seems to get the same results. I added it to a widget in the footer. Now that date the page was updated is shown.
    And I didn’t have to enter any code in any of the files.

    • Hardhik K Chitalia says:

      Code is always better than plugin bro. Code will not slow down your site, but plugins will.

      • WPBeginner Support says:

        Not exactly true. Plugins are code too, and the functions file where users usually paste code also acts as a plugin.

  6. parvez says:

    I changed post date from created to modified,its working fine,How to show DESC order modiefied date posts on wordpress.

    right now order of posts based on posted date.

  7. ryan says:

    What if I still want to keep teh original publish date?

    Something like :

    Jan. 1, 2015, last edited | published on Dec. 15, 2014 by Ryan Hipp

  8. Gabrielle says:

    I’m using _s / Underscores theme, and in my inc/temlate-files.php
    have the all time functions, how to show only posted on or only updated on time?

  9. Sasanga says:

    Why you are using this type of long code?

    We can use just “Last modified: “.

    Am I wrong?

    • Sameer Panda says:

      You want to change the text or the date?

      If you want to the modified date then, retrieve the date. And add text whatever you want before the date

  10. Sagar Patil says:

    is there any plugin available for last updated date.
    because im using ipin these and its hard to find code or related code in that.
    Thank You

  11. Damith says:

    I have a question.

    Assume that I have written a post in 2014-01-01.

    Then, a person has copied enter article on 2014-02-01 and paste it own his blog.

    I updated one or two line in 2014-03-01.

    Then what happens?

    I mean, Is Google think my article is copied article and copied article is original article? ( Because now date of my article is 2014-03-01 and copied article date is 2014-02-01).

    Your reply is highly appreciated.

    • Govind says:

      i think google is smart enough…it also consider post indexing date along with published date.

  12. Nitin Maheta says:

    Users have to look for the code :  “<?php the_time(‘F jS, Y’);?>”

    NOT  “<?php the_modified_time(‘F jS, Y’);?>”

  13. TecBrat says:

    I did it a little bit differently, but it is the same concept. Thanks for pointing me in the right direction.
    For the twentyten theme, you edit the functions.php file, replacing the contents of the twenty_ten_posted_on() function with the following code:
    $postdate = get_the_date();

    $u_time = get_the_time(‘U’);
    $u_modified_time = get_the_modified_time(‘U’);
    if ($u_modified_time >= $u_time + 86400) {
    $postdate=get_the_modified_time(‘F jS, Y’);
    echo ‘<span class="meta-prep meta-prep-author">’.$verb.’ on</span>
    <a href="’.get_permalink().’" rel="bookmark">
    <span class="entry-date">’.$postdate.'</span></a>’;

    echo ‘ <span class="meta-sep">by</span> <span class="author vcard"><a class="url fn n" href="’.get_author_posts_url( get_the_author_meta( ‘ID’ ) ).’"
    title="’.esc_attr( sprintf( __( ‘View all posts by %s’, ‘twentyten’ ), get_the_author() ) ).’">’.get_the_author().'</a></span>’;

  14. Barzrul says:

    This code doesn’t work for me. Had tried put in the theme but nothing showed up.

  15. Adriano says:

    The code is missing the most important part: else …

    the code compares the creation date of the update date, whichever is later then insert the date of update, but if the post does not have an update would not display anything, at least in my case.

    so it would be useful to add a:
    else the_time (‘F jS, Y’);

  16. Elena Nacci says:

    It’s me again:-) just another question: if I change to the “last updated on” date, the order in which my posts appear in my homepage will change?
    For ex. I publish a new article today, then later I update another older post, will the last updated post show as first in my home?
    Thanks again for your help!

  17. Elena Nacci says:

    hello, I’ve tried to find the code in any of the files index.php, single.php, page.php, but there is no trace of it.
    Where else should I look for it? Does it depend on the wp theme?
    Thanks a lot,

    • WPBeginner Support says:

      Yes there are many different WordPress Themes, Theme Frameworks, and child themes. You should ask in the support forums for your theme and they will let you know how you can add your custom code to the theme.

  18. GeraldoFilho says:

    This code doesn’t work for me, I search in codex and

    in Modified: at


  19. Arafin Shaon says:

    Hlw Syed I’ve been using genesis framework like you. So you know that genesis don’t have the following files and I guess this code snippet is not for gesesis. So it I’d be so nice of you if you kindly share the method you implemented with your child theme to show last modified date below post title instead of published date.

  20. Samedi Amba says:

    Just a small correction. It should be the genesis_before_post_content Hook, and NOT the genesi_before_content Hook, as I had earlier mentioned. ;-)

  21. jan geronimo says:

    Wow, you have many useful posts here on WordPress. You’ve forced my hand. I’m subscribing now to your feed. What a useful site you have here. I’m very impressed.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.