Home › Forums › Backend Issues (wp-admin) › Way to add a term › Reply To: Way to add a term
Found a workaround using jquery, it works with an ACF taxonomy single select drop down. It moves the add term form to just under the drop down and when a term is clicked from the drop down it populates the add term field and simulates a click on the add button.
The acf select needs to be set to not update terms.
var $j = jQuery.noConflict();
$j(document).ready(function() {
$j("#my_taxonomy").insertAfter("#acf-my_taxonomy_field");
$j("#tagsdiv-my_taxonomy").hide();
$j("#acf-my_taxonomy_field select").change(function(){
var term = $j('#acf-my_taxonomy_field select').find(":selected").text();
//alert(term);
$j('#new-tag-my_taxonomy').val(term);
$j('#my_taxonomy .tagadd').trigger('click');
});
});
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.