last update wordpress

There is a blue spot at the end of this post which mentions the “Updated” date. It is the date on which this particular post last modified or updated. Since I keep most of the old posts from time to time, thought it would be a good idea to display the date in the post well.Add the following code at the end of the current theme functions.php update.

function add_post_content($content)
    return $content . '<div class="updated_on">Last Updated On : ' . get_the_modified_time('jS F Y') .'</div>';
add_filter('the_content', 'add_post_content' , 9);

The function get_the_modified_time gets the modified time of the current post in any given format. The same is added to the post content using the ‘add_filter’ api function.

The add_filter takes a second parameter called priority. Default is 10, giving anything lesser will mean a higher priority. So we specify 9 to make it higher in priority. Higher priority is needed since many plugins also modify the contents of the post so this function must be able to execute before any other code gets in.

icon 01

Where We Are

P50 Plaza, 2nd Floor, Chenab Market, Susan Road, Faisalabad, Pakistan

icon 02

Tech Support


icon 03

E-mail Us