WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана


BlocksWpQuery::get_cached_posts() public WC 1.0

Get cached posts, if a cache exists.

A hash is generated using the array of query_vars. If doing custom queries via filters such as posts_where (where the SQL query is manipulated directly) you can still ensure there is a unique hash by injecting custom query vars via the parse_query filter. For example:

add_filter( 'parse_query', function( $wp_query ) {
	 $wp_query->query_vars['my_custom_query_var'] = true;
} );

Doing so won't have any negative effect on the query itself, and it will cause the hash to change.

{} Это метод класса: BlocksWpQuery{}

Хуков нет.


WP_Post[]/Число[]. Array of post objects or post IDs.


$BlocksWpQuery = new BlocksWpQuery();
$BlocksWpQuery->get_cached_posts( $transient_version );
Transient version to allow for invalidation.

Код BlocksWpQuery::get_cached_posts() WC 5.0.0

public function get_cached_posts( $transient_version = '' ) {
	$hash            = md5( wp_json_encode( $this->query_vars ) );
	$transient_name  = 'wc_blocks_query_' . $hash;
	$transient_value = get_transient( $transient_name );

	if ( isset( $transient_value, $transient_value['version'], $transient_value['value'] ) && $transient_value['version'] === $transient_version ) {
		return $transient_value['value'];

	$results = $this->get_posts();

			'version' => $transient_version,
			'value'   => $results,

	return $results;