This issue shouldn’t happen if you’re using the classic editor, however, if you’re using the block/Gutenberg editor which uses the REST API, then that issue can be fixed by using the wp_after_insert_post
hook instead.
Excerpt from https://make.wordpress.org/core/2020/11/20/new-action-wp_after_insert_post-in-wordpress-5-6/:
The new action
wp_after_insert_post
has been added to WordPress 5.6
to allow theme and plugin developers to run custom code after a post
and its terms and meta data have been updated.The
save_post
and related actions have commonly been used for this
purpose but these hooks can fire before terms and meta data are
updated outside of the classic editor. (For example in the REST API,
via the block editor, within the Customizer and when an auto-draft is
created.)
So try using wp_after_insert_post
:
add_action( 'wp_after_insert_post', 'get_the_terms', 10, 3 );
Related Posts:
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Dynamically set taxonomy term and show admin notice on post save
- generate random slug when adding taxonomy
- Exclude 2 in 3 terms of A Taxonomy from all Archives
- Taxonomy Child Not Updating Unless I Click Update Twice
- Hide empty categories on widget
- Get the the top-level parent of a custom taxonomy term
- get_terms – only top level
- How to only list the child terms of a taxonomy and not their parents?
- Hierarchical taxonomy UI
- Order get_terms using a Custom Field
- Using pre_get_posts to rewrite search query to display posts from multiple taxonomies
- Hide the term description on the term edit page, for a given taxonomy
- get_term_by not working when in functions.php
- Get only the first term by taxonomy
- Exclude specific slug in ‘get_terms’
- Hook to process a new taxonomy tag before it is created?
- get_terms() returns an empty array
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- How to assign default taxonomy to pages on ‘save_post’?
- Is it possible to get a Previous/Next Taxonomy term archive URL?
- WP_insert_term how to insert multiple values as taxonomny term?
- Group posts that matches a term in a loop
- Custom taxonomy term as class?
- How to edit/remove a term that’s in multiple taxonomies?
- Limits amount of terms displayed? Is it possible?
- How to add custom taxonomy to search
- how to create a proper query for getting a list of users with taxonomy related meta key
- How to List Parent Term Links for Custom Taxonomy With & Without Children?
- Generic taxonomy-term template page
- Get direct children of custom taxonomy
- List subcategory on taxonomy term page
- Operations with custom fields values in a loop
- Check if term is in a taxonomy?
- How to insert an array of terms using wp_insert_term?
- Get child product categories from parent product category in WooCommerce
- display taxonomy slug from term ID
- How to use get_the_terms() to display multiple terms?
- Display the description of taxonomy terms
- get_terms adds slaces to the resualt
- List posts of term on term’s admin edit page
- Can I use a Custom Meta Value inside of ‘get_the_terms’?
- Display only child terms of a specific parent term of a custom taxonomy, for each custom post
- Getting WooCommerce product related child categories
- Same term from custom taxonomy in two different custom post types?
- Some custom taxonomy child terms not showing in admin. Caching problem?
- How do I return all terms from multiple taxonomies?
- Order get_terms() by hierarchy
- Returning One custom taxonomy term name
- Displaying Custom Taxonomy without a hyperlink
- Get all terms, including unchecked, or get the terms outside loop
- get_term_link not working
- Query posts using custom taxonomy and selected terms
- Proper use of wp_get_object_terms
- How to support fifteen thousand terms in WordPress?
- Output all terms in a custom taxonomy and add a “active” class only to the ones attached to the current post
- Show template part if part of term
- one post per term taxonomy
- How can I change the output display of my pagination?
- Hide terms if they aren’t the same as the current term
- Corrupted nav-menu?
- The best way to display taxonomies
- WP 4.8 : new taxonomy syntax for get_term_by and get_term_link ?
- Terms change id after importing
- List Top 5 taxonomy terms based on number of post
- Can you hide empty terms using get_term_children?
- How to add custom taxonomy terms to posts in bulk
- How to add a date creation field when a custom taxonomy relationship is created?
- List terms of custom taxonomy if matches other taxonomy
- why the archive of custom taxonomy term shows nothing?
- Show related posts on single.php, grouped by taxonomy terms, with Advanced Custom Field post object selected
- Running a function only once when a taxonomy term is changed
- Displaying my custom taxonomies in a using the_term_list()
- Use wp_list_categories to list parent categories from actual term
- Include get_term_link inside search
- is there a way of getting term children that only shows those from two taxonomies
- Adding term to a custom taxonomy based on term from product category
- How to list custom taxonomy terms alphabetically by last word
- Tree view wp-admin terms
- Retrieve the child terms by having the parent’s information
- How to exclude woocommerece product category in search results?
- Order get_terms by count using a custom taxonomy hierarchy
- Add A CSS Class To A Menu Item When A Custom Taxonomy Term is Present On Single Post
- How to create a non removable taxonomy term?
- Add term to taxonomy programatically
- setting a custom post type taxonomy term by code
- Why get_terms() behaves strangely when being called in admin (for use in meta box)?
- How do I check to see if a specific child term has shared posts with another set of child terms within the same taxonomy?
- Output slugs to use as class names for every taxonomy a post is attached to
- Group & Sort Taxonomy terms by letter – Is there a better way?
- qtranslate-x problem with custom term description
- Orderby taxonomy term id using get_posts not working
- Sorting terms individually for each post
- Trying to Display Number of Posts in Term
- Order posts with custom taxonomy array
- Determine if Term has Grandparent/Great-Grandparent
- add_query_arg to look up page title
- Altering term_id and name via $wpdb class
- Create heirachy of post terms from array & assign post to terms
- How do I check if a post has a term with a particular ancestor/parent?