Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param array $fields
- * @param \GeminiLabs\SiteReviews\Arguments $args
- * @return array
- */
- add_filter('site-reviews/review-form/fields', function ($fields, $args) {
- $key = array_search('rating', array_column($fields, 'name'));
- // make sure the rating field is in the form
- if (-1 === $key) {
- return $fields;
- }
- // make sure that this is a custom form (remove this if you are not using a custom Review Form!)
- if (empty($fields[$key]['custom'])) {
- return $fields;
- }
- // make sure that the form is assigning reviews
- if (empty($args->assigned_posts)) {
- return $fields;
- }
- $fields[$key]['label'] = sprintf('How do you rate %s', get_the_title((int) $args->assigned_posts));
- return $fields;
- }, 20, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement