WordPress is_day() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Conditional tag

Definition

In WordPress, is_day() returns true on a daily archive, the page that lists posts from one calendar day. A typical URL is /2026/11/12/.

It is more exact than is_date(). A monthly or yearly archive makes is_date() true but is_day() false.

Syntax

Use it as the test of an if statement.

WordPress
if ( is_day() ) {
  // code for the true path
} else {
  // code for the false path
}
CallWhat it does
is_day()True only on a daily archive.
is_month()True only on a monthly archive.
is_date()True on any date archive.

Print the date with get_the_date() or single_month_title() style helpers.

Full declaration
WordPress
is_day(): bool

Parameters

ParameterDescription
NoneThis function takes no parameters.

Return Value

Return ValueDescription
booltrue if the main query is for a daily archive, otherwise false.

WordPress Examples

Three short theme examples. Each one shows what prints on the true path and the false path.

Example 1 — Daily archive heading

Print the day at the top of the archive.

WordPress
<?php if ( is_day() ) {
  echo '<h1>Posts from ' . get_the_date() . '</h1>';
} ?>

How It Works

  1. is_day() is true only when a day is in the URL.
  2. get_the_date() returns the date of the first post.
  3. Month and year archives skip the code.

Example 2 — Day, month, year

Choose the heading by archive type.

WordPress
<?php
if ( is_day() ) {
  echo 'Daily archive';
} elseif ( is_month() ) {
  echo 'Monthly archive';
} elseif ( is_year() ) {
  echo 'Yearly archive';
} ?>

How It Works

  1. Check the narrowest tag first.
  2. elseif runs only if the earlier tests were false.
  3. Only one message is printed.

Example 3 — Date archive that is not a day

Combine two tags.

WordPress
<?php if ( is_date() && ! is_day() ) {
  echo 'Showing a longer period';
} ?>

How It Works

  1. is_date() covers all date archives.
  2. ! is_day() removes the daily archive.
  3. Both parts must be true.

Frequently Asked Questions

It returns true or false (a bool). Use it inside an if statement.
No. It is true only on the daily archive page.
Use get_query_var( 'day' ) on a daily archive, or get_the_date( 'j' ).
is_day() checks the page type. is_new_day() is used inside the loop to see if a post is from a new day.
Conditional tags need the main query. Call them in template files or on hooks such as wp or template_redirect, not directly at the top of functions.php.

Next: is_feed()

Check if the request is for an RSS, Atom, or other feed.

is_feed() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

15 people found this page helpful