Please help. I want users to be able to add posts from the frontend. It works for me, but I do not know how to do it to choose one of the existing tags. I have this code (used from here, but adjustable for my needs):

$taxonomies = array (
$args = array (
    'orderby' => 'name',
    'order' => 'ASC',
    'hide_empty' => false

$terms = get_terms($taxonomies, $args);

if(count($terms)> 0):

    foreach ($terms as $term):?>
        <div class="wissen_tag_list">
            <input type="radio" value="<?php echo $term->term_id; ?>" name="post_tag" class="post_tag_list" <?php if? php}?>>
            <label class="post_tag_list">
                <?php echo $term->name; ?>
    $i++; endforeach;
endif; ?>

My tags will appear, but there is no one to choose. Only the first one is selected. Can you please help me where I am wrong. These are standard tags, no custom.

sample tags in the front end - there is no choice

Thank you very much.

  • please remove space like ( $ i ++; ) – user147874 Dec 18 '18 at 13:48
  • the spaces are inserted there - they are not in the code Some idea? What am I wrong about? – Václav Škvára Dec 18 '18 at 15:41
  • Can you please tell me. That what type of problem are you facing. – user147874 Dec 18 '18 at 16:14
  • I need to create new posts from the frontend. Everything is working. But I need to pick the tags from the list I define in the admin. Now I can write anything in the tag field and I do not want to. The script I've loaded works - so I get all the tags, but they can not choose. It is marked only first and the other is not selected. Maybe it's badly written, I'm not 100% sure of this. There may be another simpler solution. – Václav Škvára Dec 18 '18 at 16:29
  • Do you want to only be able to chose one tag at a time? That's how you've got it set up currently. otherwise you need to use checkboxes instead of radio inputs. probably change the name from post_tag to post_tag[] as well. – mrben522 Dec 18 '18 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.