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



wp_random_content_posts_fields › WordPress Function

Seit7.2.0
Veraltetn/v
› wp_random_content_posts_fields ( $fields, $query )
Parameter: (2)
  • (string) $fields The SELECT clause of the query.
    Erforderlich: Ja
  • (WP_Query) $query The WP_Query instance.
    Erforderlich: Ja
Gibt zurück:
  • (string) The SELECT clause of the query.
Definiert in:
Codex:

Limits the random content query to selecting post IDs.

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


Quellcode

function wp_random_content_posts_fields( $fields, WP_Query $query ): string {
	global $wpdb;

	if ( wp_is_random_content_query( $query ) ) {
		return "{$wpdb->posts}.ID";
	}

	return (string) $fields;
}