WC_Product_Data_Store_CPT::reviews_allowed_query_where( string $where, WP_Query $wp_query )
Add ability to get products by ‘reviews_allowed’ in WC_Product_Query.
Description Description
Parameters Parameters
- $where
-
(Required) Where clause.
- $wp_query
-
(Required) WP_Query instance.
Return Return
(string)
Source Source
File: includes/data-stores/class-wc-product-data-store-cpt.php
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; }
Changelog Changelog
Version | Description |
---|---|
3.2.0 | Introduced. |