Use the WordPress date format

If you use the include_date="true" parameter, Display Posts will include the post’s date using the (n/j/Y) format. Ex:

Recent Tutorials

You can customize this using the date_format parameter (see Formatting Dates and Times).

WordPress lets you specify a default date format in Settings > General > Date Format. If you would like to use that format in Display Posts, add the following code to your site:

This code snippet goes in a core functionality plugin or Code Snippets.

/**
 * Display Posts - Default Date Format
 * Uses format set in Settings > General > Date Format
 * @link https://displayposts.com/2019/09/11/use-the-wordpress-date-format/
 */
function be_dps_date_format( $out, $pairs, $atts ) {
	if( empty( $atts['date_format'] ) )
		$out['date_format'] = get_option( 'date_format' );
	return $out;
}
add_filter( 'shortcode_atts_display-posts', 'be_dps_date_format', 10, 3 );

Note: this only updates the default date format. You can still override this on a per-shortcode basis using the date_format parameter in the shortcode.

Filters used:

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.