How to Display the Last Updated Date of Your Posts in WordPress

Check Out More At: WP Beginner

WordPress: Best WordPress Plugins | WordPress Tutorials

How to Display the Last Updated Date of Your Posts in WordPress

Product Image Product Name / Primary Rating / Price Primary Button / Description
Best Wordpress Page Builder
  • Description:

    Elementor is an amazing website builder plugin for WordPress. Elementor makes it easy to create beautiful and high converting websites yourself without having to learn code.

Best WordPress Form Builder
  • Description:

    Gravity Forms is a WordPress plugin that creates powerful forms quickly and easily, with drag-and-drop fields, custom notifications and confirmations, and custom styling capability.

Best WordPress Theme
  • Description:

    Kadence Theme is a powerful, intuitive and flexible WordPress theme that offers an expansive set of features and customization options.

    It includes a robust page builder, beautiful design options, mobile-friendly responsiveness, powerful SEO tools and optimized performance for faster loading times.

    It's perfect for creating stunning websites without needing to write any code.

Best Wordpress Cloud Hosting
  • Description:

    Cloudways is a managed cloud hosting platform that simplifies cloud infrastructure deployment and management.

    It provides an intuitive dashboard, automated backups and optimized stack for speedy performance. It also provides 24x7 support with multiple server locations, enabling businesses to host their applications quickly and securely.

Best Budget WordPress Host
  • Description:

    Bluehost is an easy to use web hosting provider offering reliable, secure and affordable hosting solutions with 24/7 customer support.

Best Wordpress Page Builder
Primary Rating:
4.5
N/A
Description:

Elementor is an amazing website builder plugin for WordPress. Elementor makes it easy to create beautiful and high converting websites yourself without having to learn code.

Best WordPress Form Builder
Primary Rating:
3.5
N/A
Description:

Gravity Forms is a WordPress plugin that creates powerful forms quickly and easily, with drag-and-drop fields, custom notifications and confirmations, and custom styling capability.

Best WordPress Theme
Primary Rating:
3.5
N/A
Description:

Kadence Theme is a powerful, intuitive and flexible WordPress theme that offers an expansive set of features and customization options.

It includes a robust page builder, beautiful design options, mobile-friendly responsiveness, powerful SEO tools and optimized performance for faster loading times.

It's perfect for creating stunning websites without needing to write any code.

Best Wordpress Cloud Hosting
Primary Rating:
3.5
N/A
Description:

Cloudways is a managed cloud hosting platform that simplifies cloud infrastructure deployment and management.

It provides an intuitive dashboard, automated backups and optimized stack for speedy performance. It also provides 24x7 support with multiple server locations, enabling businesses to host their applications quickly and securely.

Best Budget WordPress Host
Primary Rating:
4.0
$3.95/Mo
Description:

Bluehost is an easy to use web hosting provider offering reliable, secure and affordable hosting solutions with 24/7 customer support.

Lasso Brag

It’s no secret that keeping your content fresh is vital to a successful website. Search engines love to see new content, and visitors appreciate knowing that they’re reading up-to-date information. For these reasons, it’s a good idea to display the last updated date of your posts in WordPress.

Fortunately, this is fairly easy to do with a little bit of code. Simply add the following to your functions.php file:

function wp_last_updated_date($format = ‘F j, Y’) {

$last_updated = get_the_modified_date($format);

echo “This post was last updated on ” . $last_updated;

}

Once you’ve added that code, you can display the last updated date of your posts by simply calling the wp_last_updated_date() function where you want it to appear. For example, you could add it to your single.php file like this:

if ( have_posts() ) {

while ( have_posts() ) {

the_post();

the_content();

wp_last_updated_date(‘F j, Y’);

} // end while

} // end if

?>

Of course, you can change the format of the date to suit your needs. For more information on date and time formatting in PHP, check out the docs at php.net/manual/en/function.date.php.

Do you have any questions about how to display the last updated date of your posts in WordPress? Let us know in the comments below!

Similar Posts