geminilabs

Untitled

Sep 10th, 2025 (edited)
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. /**
  2.  * This code snippet prevents the Review Authors addon from removing the
  3.  * name and email from a review when it is edited on the frontend with a
  4.  * custom Review Form that does not include the name and email fields.
  5.  *
  6.  * This code snippet can safely be removed from the website after
  7.  * the Review Authors addon has been updated to v2.0.0 or higher.
  8.  */
  9. add_filter('site-reviews-authors/update/review-values', function ($values, $update) {
  10.     $review = glsr_get_review($update->request->review_id);
  11.     foreach ($values as $key => $value) {
  12.         if (!$update->request->exists($key)) {
  13.             $values[$key] = $review->offsetGet($key);
  14.         }
  15.     }
  16.     return $values;
  17. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment