Home / posts / Notify readers of old posts
  • How to Notify readers of old posts


    Adding this to your wordpress theme within the loop will display a message to your visitors to notify them when a post is over a year old.

    ( click code to copy )

    wordpress snippet : PHP

    $time_defined_as_old = 60*60*24*365; // A Year
    if((date('U')-get_the_time('U')) > $time_defined_as_old) {
      echo '<div class="notice"><strong>Notice</strong><br />This article is published more than one year ago. Information in this article might be irrelevant with current situation</div>';

    ( WordPress codex functions, hooks, in this snippet. )

    get_the_time, the_time,
  • Pingback: designpoke.com()

  • Pingback: Tweets that mention Wordpress Notify readers of old posts – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com()

  • Anonymous

    Is there a way to have it notify in admin instead of live if a post has reached a certain age?

    • How are you thinking to display this? like something within the posts columns.

      • Anonymous

        Exactly, just an indicator next to the post that it hasn’t been updated in X number of months,days. 

        Also, it may be beneficial to have items in “Right Now” on the dashboard. older than 6 months, 1 year, etc.

        • Hi Zach I think you would need to have something on the dashboard, if the site was like wpsnipp.com I have over 460 posts as a result I would never see the icon unless I viewed very old posts. Ill look into the idea see if I can’t post a new snippet, great idea though.

        • Anonymous

          The exact same thing would occur with us as well. That’s why I was saying adding it to “right now” might work.