Advertisement
geminilabs

[site-reviews] Use name of user who wrote the response

Oct 10th, 2024 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. add_filter('site-reviews/review/build/tag/response/by', function ($name, $review) {
  2.     $responseBy = (int) get_post_meta($review->ID, '_response_by', true);
  3.     if ($user = get_user_by('id', $responseBy)) {
  4.         return $user->display_name ?: $name;
  5.     }
  6.     return $name;
  7. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement