wc_update_product_lookup_tables_rating_count_batch()
Populate a batch of rating count lookup table data for products.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wc_update_product_lookup_tables_rating_count_batch( $offset, $limit );
- $offset(массив)
- Offset to query.
- $limit(массив)
- Limit to query.
Список изменений
С версии 3.6.2 | Введена. |
Код wc_update_product_lookup_tables_rating_count_batch() wc update product lookup tables rating count batch WC 9.4.2
function wc_update_product_lookup_tables_rating_count_batch( $offset = 0, $limit = 0 ) { global $wpdb; if ( ! $limit ) { return; } $rating_count_rows = $wpdb->get_results( $wpdb->prepare( " SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE meta_key = '_wc_rating_count' AND meta_value != '' AND meta_value != 'a:0:{}' ORDER BY post_id ASC LIMIT %d, %d ", $offset, $limit ), ARRAY_A ); if ( $rating_count_rows ) { wc_update_product_lookup_tables_rating_count( $rating_count_rows ); WC()->queue()->schedule_single( time() + 1, 'wc_update_product_lookup_tables_rating_count_batch', array( 'offset' => $offset + $limit, 'limit' => $limit, ), 'wc_update_product_lookup_tables' ); } }