Figured it out for anyone who wants to know:
function update_school( $post_id ) {
$post_author_id = get_post_field( 'post_author', $post_id ); // get the post author ID
$school_name = get_the_author_meta( 'school2', $post_author_id ); // from the post author ID, get the author meta
$term = term_exists( $school_name, 'school');
wp_set_post_terms( $post_id, $term, 'school' );
}
// run function on post save
add_action( 'save_post', 'update_school' );
Related Posts:
- Add default WordPress tag meta box to User Profile
- Query users by custom taxonomy and user role
- get_term_by not working when in functions.php
- Can I turn off write-in tags/taxonomies?
- Formating the_terms() function output
- Scheduling posts to update once per day with wp_cron
- Connect Users and Taxonomies
- Authors details such as social media links, emails etc → Is this Meta or something else?
- How to use create_term, edit_term, delete_term actions?
- Possible to register multiple custom taxonomies in one function?
- Removing the base “Author” or changing it to something else. is it possible?
- How do I display a tag cloud with both post tags AND a custom taxonomy?
- Can I turn off write-in tags/taxonomies?
- How do I add customize_register action AFTER adding a custom taxonomy
- Adding ‘active’ class to custom taxonomies using walker in functions.php
- Check if term is in a taxonomy?
- get_term and get_term_by return null or false, even though term exists
- Get list of taxonomies associated with Subscribers
- get the taxonomies terms associated with users
- limit post by a taxonomy in the admin
- get_terms not returning any custom taxonomies
- What is the most efficient way of implementing a notification system? [closed]
- Display formatted list of taxonomy terms with last seperator different
- What is the action hook that deletes a taxonomy term from the backend? And how to retireve the term id before deleting it?
- How to call a custom taxonomy term name inside a function?
- List custom taxonomies associated to an author’s posts
- Display taxonomy with a maximum number of letters
- Update Post Taxonomy Automatically Based On Date
- Variable Not Working Inside is_author() Array
- How to output taxonomy term (incl. link to archive) on author.php?
- How to load several hierarchical categories from functions.php
- Taxonomy archive template not working
- Running a function only once when a taxonomy term is changed
- How to change the author box selection on a post to a custom taxonomy
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- Retrieve & Display User Meta Values from Checkboxes
- How to add meta fields to custom taxonomy add/edit page?
- WordPress shortcode Issue!
- How to query authors by custom taxonomy?
- Where to put code to get custom taxonomy term id?
- Function code problem
- Create WordPress taxonomies based on theme settings
- add_action with variable as a part of the $tag string
- I’ve got a function that auto creates taxonomy terms – Can it auto delete them as well?
- How can I get the term_id from the action hook ‘set_object_terms’?
- Change get_author_posts_url / Author URL via filter
- Replace post author in header by custom taxonomy
- get_the_term_list without links in 3.1
- get_term_children for immediate children only (not grandchildren)
- Custom taxonomies capabilities
- Can’t get a custom template taxonomy page to display
- Creating a non-removable taxonomy term
- Is it possible to use one slug for Multiple Taxonomies?
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)
- How do I add a custom post type to the Featured Content in twenty fourteen theme?
- get taxonomy terms for parent and child
- On Taxonomy Template page, want to add Post_Type
- The next_posts_link() show me a aditional page in blank
- Help building array hierarchically with taxonomies (to get posts)
- Next and Previous links on a single taxonomy page only link to same term
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- Get custom taxonomy description with paragraph tags
- Change permalink of post if it belongs to custom taxonomy
- How to preserve edits to Name or Slug of term when using wp_update_term on save?
- Get pages only with a specific taxonomy
- How to determine the depth of a term in a custom taxonomy?
- How do I Use Multiple Loops with WP_Query?
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- How to obtain the link/URL to the feed of a custom taxonomy?
- get_term_children doesn’t return an array of children terms
- Term count by user
- Google Map Shortcode for Custom Taxonomy/Post Types
- Querying two taxonomies
- Allow Post Author to be 0 on Update
- Custom taxonomy query is empty. 0 = 1 in SQL
- How do you reorder the custom taxonomies on the right side of a custom post edit page?
- Query posts by taxonomy with current term
- jQuery does not work
- How to add images to taxonomy terms? [duplicate]
- Echo custom taxonomy slug
- Remove a href from this code
- Adding a second custom taxonomy to a custom post type (both shown in its table)?
- Are there action hooks for comments?
- custom post type, hide or disable the status line in publish meta box
- Noindex Posts From Certain Authors In WordPress
- Get post terms from multiple custom taxonomies
- How to get attached image to taxonomy..?
- Amend taxonomy to search in wordpress admin
- Unique taxonomy for post
- filter for thumbnail not working for custom taxonomy term
- Change link of taxonomy when get_the_term_list( is used?
- Which method is more correct for removing WooCommerce Extensions menu item?
- Multi level archive
- Displaying posts from a custom category
- Broken paths on taxonomies after changing permalink to post name
- Where to put a migration script to switch post information?
- Get post terms with hierarchical relationships
- Error in Custom Taxonomy UI
- Add taxonomy fields of posts into RSS feed