CCCPaste

Require the content field if rating is less t...

/**
 * Require the content field if the submitted rating is less than 4-stars
 *
 * Make sure to set the email field as not required in the Settings
 * otherwise this will do nothing.
 *
 * @param \GeminiLabs\SiteReviews\Request $request
 */
add_filter('site-reviews/validation/rules/normalized', function (array $rules, $request): array {
    if ($request->rating < 4) {
        $rules['content'] = 'required';
    }
    return $rules;
}, 10, 2);