wordpress: display current tag-id

tags, wordpress

Solution

You can do the following

     $tag_id = get_queried_object()->term_id;

And then

    $args = array(
        'tag' => $tag_id,
    );

Problem

With ``` $tag = single_tag_title('', false); ``` I can get the name of the currently chosen tag. Right? But how can I get also the ID of the chosen tag? "single_tag_id" does not exist. And afterwards I would like to show only posts with the tag-id. ``` $args = array( 'tag' => 'ID HERE?', ); ``` But I can not put a number into 'tag'. How can I filter with tag-id and not do it by name?

Original source