Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Removes empty custom rating tags.
- * @param array $tags
- * @param \GeminiLabs\SiteReviews\Review $review
- * @param \GeminiLabs\SiteReviews\Modules\Html\ReviewHtml $reviewHtml
- * @return array
- */
- add_filter('site-reviews/review/build/after', function ($tags, $review, $reviewHtml) {
- // Change this array to include your custom rating field names
- // The array key is the field name
- // The array value is the field template tag
- $customRatings = [
- 'sound_rating' => 'sound_rating',
- 'noise_rating' => 'the_noise_rating',
- ];
- foreach ($review->custom as $key => $value) {
- if (array_key_exists($key, $customRatings) && empty($value)) {
- $tags[$customRatings[$key]] = '';
- }
- }
- return $tags;
- }, 15, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement