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



wp_random_content_posts_where › WordPress Function

Depuis7.2.0
Dépréciéen/a
› wp_random_content_posts_where ( $where, $query )
Paramètres: (2)
  • (string) $where The WHERE clause of the query.
    Requis: Oui
  • (WP_Query) $query The WP_Query instance.
    Requis: Oui
Voir:
Retourne:
  • (string) The WHERE clause of the query.
Défini(e) dans:
Codex:

Limits the random content query to the random post IDs.

Added to the 'posts_where'} filter by {@see WP::handle_random while the random content query runs.


Source

function wp_random_content_posts_where( $where, WP_Query $query ): string {
	$sample_ids = $query->get( 'random_sample_ids' );

	if ( wp_is_random_content_query( $query ) && is_array( $sample_ids ) && $sample_ids ) {
		$where .= ' AND ' . _wp_random_content_sample_clause( $sample_ids );
	}

	return (string) $where;
}