geminilabs

Untitled

May 13th, 2022 (edited)
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. /**
  2.  * Add the "disable-select" class to the rating SELECT element to prevent it from being transformed by select2
  3.  * @param array $field
  4.  * @return array
  5.  */
  6. add_filter('site-reviews/field/rating', function ($field) {
  7.     $classes = explode(' ', $field['class']);
  8.     $classes[] = 'disable-select'; // prevent select2 from modifying the rating field
  9.     $field['class'] = implode(' ', $classes);
  10.     return $field;
  11. });
Add Comment
Please, Sign In to add comment