Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get day link



Returns the daily archive URL to a specific year, month and day for use in PHP. It does NOT display the URL. If year, month and day parameters are set to '', the tag returns the URL for the current day's archive.


 <?php get_day_link$year$month$day ); ?> 


(boolean/integer) (required) The year for the archive. Use '' to assign current year.
Default: None
(boolean/integer) (required) The month for the archive. Use '' to assign current month.
Default: None
(boolean/integer) (required) The day for the archive. Use '' to assign current day.
Default: None

Return Values

The URL for the day's archive


Current Day as Link

Returns the URL to the current day's archive as a link by displaying it within an anchor tag with the PHP echo command.

<a href="<?php echo get_day_link('', '', ''); ?>">Today's posts</a>

Use With Variables

PHP code block for use within The Loop: Assigns year, month and day of a post to the variables $arc_year, $arc_month and $arc_day. These are used with the get_day_link() tag, which returns the URL as a link to the daily archive for that post, displaying it within an anchor tag with the PHP echo command. See Formatting Date and Time for info on format strings used in get_the_time() tag.

$archive_year  = get_the_time('Y'); 
$archive_month = get_the_time('m'); 
$archive_day   = get_the_time('d'); 
<a href="<?php echo get_day_link( $archive_year, $archive_month, $archive_day); ?>">This day's posts</a>


Since: 1.0.0

Source File

get_day_link() is located in wp-includes/link-template.php.


get_calendar(), get_day_link(), get_month_link(), get_the_date(), get_the_time(), get_year_link(), single_month_title(), the_date(), the_date_xml(), the_modified_date(), get_the_modified_date(), the_modified_time(), get_the_modified_time(), the_time()

See also index of Function Reference and index of Template Tags.