Merge pull request #31004 from matt-h/review-filter

Add Product Reviews filter for `review` comment type.
This commit is contained in:
Barry Hughes 2021-11-15 10:26:28 -08:00 committed by GitHub
commit a236bdca19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -46,6 +46,9 @@ class WC_Comments {
// Support avatars for `review` comment type.
add_filter( 'get_avatar_comment_types', array( __CLASS__, 'add_avatar_for_review_comment_type' ) );
// Add Product Reviews filter for `review` comment type.
add_filter( 'admin_comment_types_dropdown', array( __CLASS__, 'add_review_comment_filter' ) );
// Review of verified purchase.
add_action( 'comment_post', array( __CLASS__, 'add_comment_purchase_verification' ) );
@ -293,6 +296,20 @@ class WC_Comments {
return array_merge( $comment_types, array( 'review' ) );
}
/**
* Add Product Reviews filter for `review` comment type.
*
* @since 6.0.0
*
* @param array $comment_types Array of comment type labels keyed by their name.
*
* @return array
*/
public static function add_review_comment_filter( array $comment_types ): array {
$comment_types['review'] = __( 'Product Reviews', 'woocommerce' );
return $comment_types;
}
/**
* Determine if a review is from a verified owner at submission.
*