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



wp_random_content_split_the_query › WordPress Function

Seit7.2.0
Veraltetn/v
› wp_random_content_split_the_query ( $split_the_query, $query )
Parameter: (2)
  • (bool) $split_the_query Whether or not to split the query.
    Erforderlich: Ja
  • (WP_Query) $query The WP_Query instance.
    Erforderlich: Ja
Gibt zurück:
  • (bool) Whether or not to split the query.
Definiert in:
Codex:

Prevents the random content query from being split into multiple database queries.

Randomly ordered queries are not cached, so there is no benefit to querying the post IDs separately to the post objects. Disabling the split allows the random post to be retrieved in a single database query.


Quellcode

function wp_random_content_split_the_query( $split_the_query, WP_Query $query ): bool {
	if ( wp_is_random_content_query( $query ) ) {
		return false;
	}

	return (bool) $split_the_query;
}