How To Display Last Updated Date In Astra WordPress Theme?

Freshening up your content has a lot of benefits! Google values fresh content and the searches also look for the latest information available. And hence, removing the date from your articles is a bad SEO practice.

  • Gives the best user experience as your readers would feel good that they are on the most recent content.
  • Google introduced the EAT (Expertise, Authoritativeness, Trustworthiness) terminology in 2018 and yes, it is a ranking factor. Exhibiting the most recent date on your content reveals to Google that you stay active and value your readers’ requirements which in turn improves your EAT score.
  • The recently updated date will get displayed in the search engine results and hence it boosts the CTR. Finally, you will get increased leads or subscribers through more organic traffic.

In this tutorial, we are going to add the last updated date in Astra Theme with the help of code inserted into functions.php.

You can also use several last-updated date-related plugins. Here we are going to use the child theme method or use the code snippets plugin to insert code in functions.php. Along with it, I am going to test the plugin method too.

In this guide, you will also learn to

  1. Use the last updated date in Child Theme.
  2. Use the Code Snippets to insert code.
How To Display Last Updated Date In Astra WordPress

Download Your Astra Child Theme

Here is your Astra Child theme Download the child theme and upload and Install it in the WordPress theme and Activate the Child Theme.

Copy The code and Paste In Child Theme

/**
 * Display only last modified date in the post metadata.
 */
function your_prefix_post_date( $output ) {
	$output        = 'Last Modified on';
	$format        = apply_filters( 'astra_post_date_format', '' );
	$modified_date = esc_html( get_the_modified_date( $format ) );
	$modified_on   = sprintf(
		esc_html( '%s' ),
		$modified_date
	);
	$output       .= '';
	$output       .= ' ' . $modified_on . '';
	$output       .= '';
	return $output;
}
add_filter( 'astra_post_date', 'your_prefix_post_date' );

1 thought on “How To Display Last Updated Date In Astra WordPress Theme?”

Leave a Comment

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

Scroll to Top