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
- How to Add Custom Fields to Custom Taxonomies in WordPress CLEANLY
- WordPress custom taxonomy description for each post?
- Get current term’s ID
- How to set hierarchical terms to a post using wp_set_object_terms
- Get list of terms of current taxonomy archive for another taxonomy
- Display empty taxonomy terms with get_terms()
- Adding Multiple Values to a Post Meta Key
- PHP Customization: Taxonomies and Queries, why? [closed]
- Problems with function on function.php
- Allow only 1 instance of each term in each custom taxonomy
- Make first letter of my taxonomy uppercase
- get_terms: determine if taxonomy term has children
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- multiple taxonomy select display only one in front end
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- How to show only subcategories in parent category not parent category?
- Get only immediate children (and not grandchildren) of a hierarchical custom taxonomy term
- How to add custom meta to ‘pre_get_terms’?
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Show template part if part of term
- fetch woocommerce product with custom taxonomy
- Corrupted nav-menu?
- List Top 5 taxonomy terms based on number of post
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- Include get_term_link inside search
- How to update posts’ custom taxonomy selection?
- How to order taxonomy terms by most recent post?
- Editing the term_order field
- Permalink like example.com/taxonomy/post_type/postname
- How to insert text into post based on category – via single.php file
- Pages of my taxonomy terms are showing all posts
- Get Posts by Custom Taxonomy on Custom Post
- str_replace not preserving whitespace
- How to associate dynamic PHP page for chosen WordPress tag?
- How to replace hard-coded list of custom taxonomy terms based on custom field query [closed]
- How to hide the Duplicate taxonomy values in WordPress?
- Get category id for a custom category and display it in a class
- How to get the count for each taxonomy term
- Exclude 2 in 3 terms of A Taxonomy from all Archives
- wordpress taxonomy in regular posts
- get_the_term_list give me a whitespace
- How do I check if a post has a term with a particular ancestor/parent?