How to show when the last time the whole WordPress site was updated rather than just the current page

A customer wanted to show visitors when the last modification to the whole wordpress site was on the home page. There’s a function in WordPress which give you the function to the current post or page which is :

the_modified_time('F j, Y');

However to find out the whole site, you need to do the current MySQL Query :

$last_site_update = $wpdb->get_var( "SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified DESC LIMIT 1" );

Then you can formulate it with PHP’s Date Function e.g. : echo date(‘F j, Y’, strtotime($last_site_update));

 

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: wordpress last update time, wordpress site last update date

Trackback from your site.