Try hooking into ‘save_post’ action:
add_action( 'save_post', 'your_state_term_save' );
function your_state_term_save( $post_id ){
// Bail if we're doing an auto save
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
//check if they selected your state term
$state = isset($_POST['tax_input_field_name']) ? $_POST['tax_input_field_name'] : ''; //make sure of what the input name is here...
//insert post meta
update_post_meta($post_id,'state',$state);
}
This works by waiting till the post is saved and grabbing the taxonomy term right out of the $_POST
vairable.
Related Posts:
- How to modify a taxonomy that’s already registered
- Change order of Custom Taxonomy List
- Remove taxonomy base or term from url
- Why is my working Custom Taxonomy not in get_taxonomies array?
- Custom taxonomy listing page when no term set (all terms)
- Custom order of terms for custom taxonomy in admin and website
- RSS Feed for posts containing any term from a taxonomy
- How to enable hierarchical permalinks for hierarchical taxonomies
- Exclude Child Term Posts from Parent Term Archive
- Create taxonomy with meta term using the WP Rest Api
- Use custom posts as taxonomy term meta replacement?
- Remove description in custom taxonomy edit screen
- Taxonomies not appearing in columns on dashboard
- Custom Taxonomy terms with latest post ordered by date pagination issue
- Make Custom Taxonomy Category Use Parent Template
- Custom taxonomy template not working
- How to call custom taxonomy categories with shortcodes
- How to get terms of a custom post type in a loop inside footer.php
- List only first-level children of specific custom taxonomy term
- Sorting Posts Via Custom Taxonomy Values Using Checkboxes?
- get_terms of post->id
- get / list categories and counts filtered by custom taxonomy term
- How do I make a custom taxomony appear like tags?
- Refine user taxonomy query based on role
- Get ID and slug from taxonomy object
- how to search in custom fields & custom taxonomy for custom search
- List Custom Taxonomy Based on Post Count & Category
- List the number of posts for each custom taxonomy and specific custom field value
- Recreating the hierarchy of taxonomies for a dropdown form menu?
- Echo specific term in an array
- showing custom taxonomies w/custom post type
- Exclude Taxonomy Terms from Template Via Back End?
- wp_insert_post not updating custom taxonomy selected if logged in as a subscriber
- How to overwrite registered taxonomy url from vendor plugin in child theme
- Dynamic loading of Archive content based on custom taxonomy term name
- Print terms with taxonomy and metabox value
- Checking return with WP Error
- Why is the custom taxonomy archive page redirecting me to a single post? [closed]
- Rewrite URL for taxonomy listing
- Return terms from multiple taxonomies using $wpdb
- Failure to add term meta
- Filter custom taxonomy archive posts by 2nd custom taxonomy using select dropdown
- How to show all post related taxonomies
- Creating terms vs custom post meta to save data?
- get_term_children returns unknown int though term has no child
- I don’t need ‘view’ page for my custom taxonomy
- WordPress implode & wp_insert_post question
- If Custom Taxonomy
- What does ‘category__in’ mean in queries?
- Use the same taxonomy twice on the same post type?
- When filtering query on custom taxonomy; main menu dissapears
- Get only immediate children (and not grandchildren) of a hierarchical custom taxonomy term
- Why doesnt this query work? (Custom Taxonomy)
- How to group all terms children’s in custom taxonomy?
- Display Posts by Custom Taxonomy Chosen Terms
- How do I get term data associated with the current post, where the result is not wrapped in HTML?
- Custom taxonomies mixed into categories and tags in Post edit page
- get_term_by works but get_terms doesn’t?
- How to get product order by two custom taxonomy in wordpress
- How can i add custom field inside custom post taxonomy?
- Custom Taxonomy Not Saving in Front End Post
- How to list Custom Taxonomy
- How to output taxonomy term (incl. link to archive) on author.php?
- Featured Images for Tags?
- Taxonomize taxonomy terms?
- Taxonomy archive template not working
- Showing relevant categories on custom taxonomy template
- Dropdown list of taxonomies won’t display selected
- Creating a drop-down and filter button for two custom taxonomies assigned to a custom post type
- custom taxonomies on pages
- Set two terms for a post when they differ only by an accent
- Unknown column ‘wp_posts.ID’ in ‘field list
- Conditional if is single and part of the custom taxonomy
- how to show product custom taxonomies in woocommerce rest api
- Auto add custom taxonomy to permalink when save
- Show latest used taxonomy in homepage
- Link a page from admin to a custom taxonomy
- What’s the url queryvar for a taxnomy archive?
- set_object_terms for custom taxonomy in custom post type – not working
- Get all users attached to a taxonomy
- Permalinks incorrectly inserting multiple categories
- List active taxonomy terms
- Permalink Rewrite to include Custom Taxonomy Term
- How do you move custom fields to custom taxonomies using WP Queries
- Differentiate Parent & Child of Custom Taxonomy
- Listing all selected terms for custom taxonomies on a post
- Where to put code to get custom taxonomy term id?
- Calling Custom Taxonomy Dropdown in Form
- Select default taxonomy on dropdown
- Taxonomy Extra Meta [duplicate]
- How can I query for all values of a custom taxonomies?
- Returning info from MYSQL table via custom taxonomy
- Custom Taxonomy – Archive for the whole Custom Taxonomy (and not just single term)?
- get_terms() – unexpected ‘=>’ (T_DOUBLE_ARROW) error
- Guest author – URL, base and custom taxonomy – working but unstable
- add_rewrite_rule pagination 404 error on page 4 and above
- Taxonomies starting with a hyphen (minus) to assign B.C. dates to a post
- Rewrite URL for a specific taxonomy [duplicate]
- Template hierarchy html with taxonomy in 6.2
- Hide empty categories on widget