WC_Product_Data_Store_CPT::reviews_allowed_query_where()
Add ability to get products by 'reviews_allowed' in WC_Product_Query.
Метод класса: WC_Product_Data_Store_CPT{}
Хуков нет.
Возвращает
Строку
.
Использование
$WC_Product_Data_Store_CPT = new WC_Product_Data_Store_CPT(); $WC_Product_Data_Store_CPT->reviews_allowed_query_where( $where, $wp_query );
- $where(строка) (обязательный)
- Where clause.
- $wp_query(WP_Query) (обязательный)
- WP_Query instance.
Список изменений
С версии 3.2.0 | Введена. |
Код WC_Product_Data_Store_CPT::reviews_allowed_query_where() WC Product Data Store CPT::reviews allowed query where WC 8.7.0
public function reviews_allowed_query_where( $where, $wp_query ) { global $wpdb; if ( isset( $wp_query->query_vars['reviews_allowed'] ) && is_bool( $wp_query->query_vars['reviews_allowed'] ) ) { if ( $wp_query->query_vars['reviews_allowed'] ) { $where .= " AND $wpdb->posts.comment_status = 'open'"; } else { $where .= " AND $wpdb->posts.comment_status = 'closed'"; } } return $where; }