Advertisement
geminilabs

[site-reviews] Link author names to their public profile page

Nov 23rd, 2024
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. /**
  2.  * @param \GeminiLabs\SiteReviews\Modules\Html\Tags\Tag $tag
  3.  */
  4. add_filter('site-reviews/review/value/author', function (string $name, $tag): string {
  5.     if ($user = $tag->review->user()) {
  6.         $url = get_author_posts_url($user->ID); // change this part if using custom User URLs
  7.         $url = esc_url($url);
  8.         return "<a href='{$url}'>{$name}</a>";
  9.     }
  10.     return $value;
  11. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement