Home › Forums › Backend Issues (wp-admin) › Change Taxonomy Terms to Slugs in Admin Post Editor › Reply To: Change Taxonomy Terms to Slugs in Admin Post Editor
Ok, so there is a hack way of doing what I want.
In taxonomy.php i modified line 1020 from this:
// append
$output .= '<li data-id="' . $term->term_id . '"><label><input type="' . $this->field['field_type'] . '" name="' . $this->field['name'] . '" value="' . $term->term_id . '" ' . ($selected ? 'checked="checked"' : '') . ' /> <span>' . $term->name . '</span></label>';
}
to this:
// append
$output .= '<li data-id="' . $term->term_id . '"><label><input type="' . $this->field['field_type'] . '" name="' . $this->field['name'] . '" value="' . $term->term_id . '" ' . ($selected ? 'checked="checked"' : '') . ' /> <span>'. $term->slug .'-' . $term->name . '</span></label>';
}
adding in the ‘$term->slug’ in the label span.
So now a term looks like:
1132-Forest Nurseries and Gathering of Forest Products
With 1132 being the slug.
This isn’t a good solution, since it could get overwritten, so just need to find out how to make that work….
Especially because I have a second Taxonomy field (different taxonomy) that I don’t want the slug to show up on….
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.