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



wp_random_content_post_limits › WordPress Function

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

Removes the limit of the random content query.

The random content query is limited to random post IDs, one of which is selected once the query has run, see wp_random_content_posts_pre_query. Added to the 'post_limits'} filter by {@see WP::handle_random while the random content query runs. Enforcing the limit in SQL prevents {@see 'pre_get_posts'} callbacks setting the number of posts, offset or page on archives from affecting the selection.


Source

function wp_random_content_post_limits( $limits, WP_Query $query ): string {
	if ( wp_is_random_content_query( $query ) ) {
		return '';
	}

	return (string) $limits;
}