WordPress at a glance

is_time() WP 1.5.0

Determines whether the query is for a time-based archive page (page of posts for the specified time). A conditional tag.

It returns true when the request (in the URL) contains the archive time: hour, minute, second.

This function is a part of is_date() check, so in a logical chain is_time() should be used BEFORE is_date().

Works based on: WP_Query::is_time()
✈ 1 time = 0.00008s = very fast | 50000 times = 0.02s = speed of light

No Hooks.

Return

true/false.

Usage

is_time();

Notes

  • Global. WP_Query. $wp_query Global WP_Query instance.

Changelog

Since 1.5.0 Introduced.

Code of is time: wp-includes/query.php WP 5.2.4

<?php
function is_time() {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
		return false;
	}

	return $wp_query->is_time();
}

Related Functions

From tag: Conditional tags (page type and request)

More from tag: Conditional tags (all)

More from category: Queries

No comments
    Hello, !     Log In . Register