wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



is_random › WordPress Function

Od7.2.0
Przestarzałyn/a
› is_random ( Brak parametrów )
Zobacz:
Powrót:
  • (bool) Whether the query is for random content.
Zdefiniowane na:
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/.


Źródło

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