How to Display "Last Updated" Date Instead of "Published" Date in Astra?

No results found. Try again with different words?

Search must be at least 3 characters.

    How to Display “Last Updated” instead of “Published” Date

    Astra by default displays the date when a post was published to your website visitors. Plus it adds the date when the post was last updated in the code – for SEO and Schema Markup.

    Published date is displayed in the front end

    Both, published as well as updated dates are available in the markup.

    If you want to display last updated date for the post to your visitors, use the following custom code –

    /**
     * Display only last modified date in the post metadata.
     *
     * @param String $output Markup for the last modified date.
     * @return void
     */
    function your_prefix_post_date( $output ) {
    	$output        = '';
    	$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' );
    

    It hides the published date and makes updated date visible.

    Note:

    Add the above code into the child theme’s functions.php file.

    Was this article helpful?
    Did not find a solution? We are here to help you succeed.

    Related Docs

    Scroll to Top

    Download is Just A Click Away!

    Be among the first to try the beta version of Astra’s Header Footer Builder. Filling the form will ensure you’ll be the first to learn about updates and features.

    Download is Just A Click Away!

    Enter your email address and be the first to learn about updates and new features.