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.


Top ↑

Return Return

(string)


Top ↑

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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.