Advertisement
geminilabs

[site-reviews] Add author link to author name in review

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