Advertisement
geminilabs

[site-reviews] Use Anonymous if a name is not given

Jan 17th, 2023 (edited)
1,602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. /**
  2.  * Always use "Anonymous" when a name is not given (i.e. do not use the display name of the user)
  3.  *
  4.  * @param array $values
  5.  * @param string $method
  6.  * @param array $args
  7.  * @return array
  8.  */
  9. add_filter('site-reviews/defaults/create-review', function (array $values, $method, $args) {
  10.     if (empty($args['name'])) {
  11.         $values['name'] = 'Anonymous';
  12.     }
  13.     return $values;
  14. }, 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement