• Resolved elkebirmed

    (@elkebirmed)


    I need to get the permalink of a specified tag by it’s name in the WordPress shortcode function, the shortcode look like so:

    function shortcode_hashtag($attr, $content){
      $tagId = get_term_by('name', do_shortcode($content), 'tag');
      return '<a href="'.get_tag_link($tagId).'" title="">'.do_shortcode($content).'</a>';
    }
    
    add_shortcode('hash', 'shortcode_hashtag');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘tag link by tag name in a shortcode’ is closed to new replies.