BlocksWpQuery::get_cached_posts( string $transient_version = '' )
Get cached posts, if a cache exists.
Description Description
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.
Parameters Parameters
- $transient_version
-
(Optional) Transient version to allow for invalidation.
Default value: ''
Return Return
(AutomatticWooCommerceBlocksUtilsWP_Post[]|int[]) Array of post objects or post IDs.
Source Source
File: packages/woocommerce-blocks/src/Utils/BlocksWpQuery.php