wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_random_content_posts_fields › WordPress Function

Since7.2.0
已弃用n/a
› wp_random_content_posts_fields ( $fields, $query )
参数: (2)
  • (string) $fields The SELECT clause of the query.
    Required: Yes
  • (WP_Query) $query The WP_Query instance.
    Required: Yes
返回:
  • (string) The SELECT clause of the query.
定义在:
文档:

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.


源码

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