wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



is_random › WordPress Function

Depuis7.2.0
Dépréciéen/a
› is_random ( Pas de paramètres )
Voir:
Retourne:
  • (bool) Whether the query is for random content.
Défini(e) dans:
Codex:

Determines whether the query is for random content.

True for a blog home or archive request that includes the random query variable, for example example.com/random/ or example.com/random/category/news/. Search, feed, trackback, robots.txt, favicon and sitemap requests are never for random content.


Fonctions en relation: is_admin, is_taxonomy, is_user_admin, is_home, is_info

Source

function is_random(): bool {
	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.' ), '7.2.0' );
		return false;
	}

	return $wp_query->is_random();
}