posts_clauses_request хук-фильтрWP 3.1.0

Filters all query clauses at once, for convenience.

For use by caching plugins.

Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT, fields (SELECT), and LIMIT clauses.

Использование

add_filter( 'posts_clauses_request', 'wp_kama_posts_clauses_request_filter' );

/**
 * Function for `posts_clauses_request` filter-hook.
 * 
 * @param string[] $clauses Associative array of the clauses for the query.
 *
 * @return string[]
 */
function wp_kama_posts_clauses_request_filter( $clauses ){

	// filter...
	return $clauses;
}
$clauses(string[])

Associative array of the clauses for the query.

  • where(строка)
    The WHERE clause of the query.

  • groupby(строка)
    The GROUP BY clause of the query.

  • join(строка)
    The JOIN clause of the query.

  • orderby(строка)
    The ORDER BY clause of the query.

  • distinct(строка)
    The DISTINCT clause of the query.

  • fields(строка)
    The SELECT clause of the query.

  • limits(строка)
    The LIMIT clause of the query.

Список изменений

С версии 3.1.0 Введена.

Где вызывается хук

WP_Query::get_posts()
posts_clauses_request
wp-includes/class-wp-query.php 3151
$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );

Где используется хук в WordPress

Использование не найдено.