The default fields name
, slug
and description
are not term metadata, so you should instead use wp_update_term()
to update those fields.
So just replace those three add_term_meta()
with:
wp_update_term( $term_id, 'codes', [
'name' => $name,
'slug' => $slug,
'description' => $desc,
] );
Additionally, instead of using $_POST
, I would use get_term()
to get the details of the term that has just been created. So for example,
$term = get_term( $term_id );
// Catch the term info
$name = $term->name;
$slug = $term->slug;
$desc = $term->description;
Related Posts:
- How to get post’s current parent term ID?
- Copy taxonomy terms from one post to another programmatically
- Hierarchical taxonomy list with modificated term links
- Exclude product attributes from taxonomy terms loop
- update_term_meta() only updating once on certain meta keys
- Show all terms of a custom taxonomy?
- How to find objects by terms
- Display certain amount of posts on taxonomy archive page
- Get used terms by an author as array of strings
- How to get the term before the last from a custom taxonomy?
- Get all taxonomies for all post types
- How do I get taxonomy terms by ID in a specific order
- WP_Query use for a filter with multiple Taxonomies and Terms
- Display Post co-authored in Author Page
- conditional statement for custom taxonomy
- Get taxonomy terms only of the WP_Query current posts
- get_the_terms – only top level
- get_terms orderby numeric
- Rename “Portfolio” slug?
- Query all posts of a custom taxonomy term
- get_term_link() returns incorrect url
- Create a hierarchical taxonomy list in WordPress
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- How to get original custom taxonomy slug after the slug has been rewritten?
- Get term siblings of current child taxonomy
- List taxonomy term slugs within shortcode (do_shortcode)
- Hide image if taxonomy term is empty
- Isotope Drop Down Categories Filter Function
- Show the section only if custom taxonomy was chosen
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- Create a a form for custom taxonomy terms
- WordPress custom taxonomy
- How to break up php code to avoid echo
- PHP displaying wrong custom taxonomy images
- Trying to display terms from custom taxonomy within function
- Hi need update in my terms for other taxonomy
- How to change the author box selection on a post to a custom taxonomy
- WordPress: Export/Import Yoast meta title & description to custom taxonomy
- Show related products by attribute based and certain conditions
- Display acf taxonomy attachment
- How to hide a child category and show his parent category
- How do I edit the terms output args or array data?
- How to retrieve taxonomy Metabox fields in frontend
- ACF Taxonomy field values not select in backend
- ACF – Can’t get custom post type by taxonomy
- WordPress search query, how to modify the sql
- New term taxonomy and description in front page. Input’s
- how to display child terms with parent terms in custom taxonomy?
- How to display terms from two taxonomies in one php code?
- Custom Taxonomy as Link
- Pass custom value to custom taxonomy
- Get all the contents of taxonomy and sort by term
- Query specific posts per user selections from dropdown menus
- ISOTOPE – Missing/Invalid Arguement Get Terms
- WordPress different custom tag being displayed in on tag list
- Three different queries on same page
- WordPress taxonomy and terms question
- Put ACF function output code the_terms
- Hiearchical terms structure and performance
- WP_Query – How to query all of post types categories
- Set two terms for a post when they differ only by an accent
- Filter taxonomy by CPT
- Get taxonomy terms that share a common object property
- How to update posts’ custom taxonomy selection?
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- How to add Text before my Custom Term and hide it when empty
- Retrieve the child terms by having the parent’s information
- add pagination in wordpress page template
- Multiple Tag Filtering
- How to order taxonomy terms by most recent post?
- Categories does not show Block editor WordPress
- Listing Cities A custom taxonmy by selection order
- Cloning product not copying custom taxonomies
- Create category after theme setup and modify the default one
- custom taxonomies not working
- Get WooCommerce product category list in functions.php
- How to create a non removable taxonomy term?
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- Search for single post by 2 tags
- Taxonomies are not showing in the category dropdown
- How to separate the taxonomies list from the form so that editing taxonmies is the same as pages and posts?
- $_GET[‘title’] in WordPress
- wp_set_object_terms returns 500 error when called through AJAX function
- Editing the term_order field
- Filter “get_terms” query
- Permalink like example.com/taxonomy/post_type/postname
- Get all posts for custom taxonomy term
- Using Sprit-sheet on WordPress categories
- Custom Taxonomy – fields
- Add Custom Taxonomy into Script
- How to insert text into post based on category – via single.php file
- Displaying child taxonomy before parent
- Pages of my taxonomy terms are showing all posts
- tax_query not working?
- generate random slug when adding taxonomy
- Get Posts by Custom Taxonomy on Custom Post
- Add active class to foundation 6 tabs while looping categories
- Get Highest and Lowest get_term_meta() value from Taxonomy Term
- How to define a custom hierarchy for terms?