Home Forums Backend Issues (wp-admin) Updating taxonomy fields


Updating taxonomy fields

  • Hi Eliott, and thanks for your plugins !

    First of all, i’m a real noob on WP…

    I’m trying to use taxonomy fields like categories metaboxes. In other words, i’d like to add a “add new” button under the field, so that users (e.g. autors) can either select values already saved, or add a new value, while creating a new post.
    Is it possible with ACF ?

    A possible solution (?) : use taxonomy fields and metaboxes together. If a value doesn’t exist, the user adds it to the regular metabox, and the value is added to the taxonomy field. I have tried that way, but there is a update issue (the field is not updated after a new value has been created).

    Do you know a trick ? I suppose JS can be very helpfull here

    Thanks !

  • I may have found somehting :

    in wp-admin\include\meta-boxes.php, search <p> markup with the class
    class="category-add wp-hidden-child"

    on <input type="button" add a onclick :

    <input type="button" onclick="refresh_taxonomy_field_<?php echo $taxonomy; ?>();"

    after this, add a JS :

    echo '<script type="text/javascript">
    function refresh_taxonomy_field_'.$taxonomy.'() {
      var new_val = document.getElementById("new'.$taxonomy.'").value;
      var acf_field = document.getElementById("acf-field-'.$taxonomy.'");
      var opt = document.createElement("option");
      opt.value = new_val;
      opt.innerHTML = new_val;

    not very clean, but it works !

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Updating taxonomy fields’ is closed to new replies.