wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



is_random › WordPress Function

Seit7.2.0
Veraltetn/v
› is_random ( Keine Parameter )
Siehe:
Gibt zurück:
  • (bool) Whether the query is for random content.
Definiert in:
Codex:

Determines whether the query is for random content.

True for a blog home, archive or search request that includes the random query variable, for example example.com/random/ or example.com/random/category/news/.


Quellcode

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();
}