function get_the_date( $d = '' ) {}

Retrieve the date the current $post was written.
Unlike the_date() this function will always return the date. Modify output with ‘get_the_date’ filter.


  • string $d: Optional. PHP date format defaults to the date_format option if not specified.

Return values

returns:Null if displaying, string if retrieving.

Defined filters

  • get_the_date
    apply_filters('get_the_date', $the_date, $d)

Source code

function get_the_date( $d = '' ) {

	global $post;

	$the_date = '';

	if ( '' == $d )

		$the_date .= mysql2date(get_option('date_format'), $post->post_date);


		$the_date .= mysql2date($d, $post->post_date);

	return apply_filters('get_the_date', $the_date, $d);



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: