Most Recent Update Time In WordPress

WordPress

This simple function will return the date and time of the last update to your WordPress website.

Paste this code in the functions.php file for your theme:

function get_last_update_date($format = 'r') {
    global $wpdb;
    $timestamp = $wpdb->get_var( "SELECT post_modified FROM $wpdb->posts ORDER BY post_modified DESC LIMIT 1" );
    return date($format, strtotime( $timestamp ));
}

Call the function with whatever date format you want, and voila!

Would you like to share your thoughts?

Your email address will not be published. Required fields are marked *