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
- Include posts under a custom taxonomy in author.php
- How to get posts which must match both custom taxonomies?
- Front-End Custom Taxonomy Tag Select
- Multi-select field for Taxonomy can’t save the value
- How can I unregister a custom taxonomy?
- Display all taxonomy, children and grandchildren with links
- List Posts For Terms Of A Custom Taxonomy For Any Post Type
- Using custom taxonomies to display hierarchical URLs?
- How to Display a menu only if it has Posts in Custom Menu?
- Clicking Add New button for custom taxonomy only moves element
- Update user meta of author when post content is viewed
- Query posts from a child taxonomy term id
- Passing form inputs into multi-taxonomy query
- Pagination on Custom Tax Pages Removes Spaces from Query Vars
- Custom Taxonomy Tag Cloud?
- Prevent users from adding taxonomy terms
- Taxonomy Rewrite Rules Redirecting Instead of Masking
- Create custom taxonomy and Display in metabox dropdown
- Function added using `add_action()` not being called
- Different Category system needed for the Custom Post Type
- I don’t need ‘view’ page for my custom taxonomy
- Custom Taxonomy with tax_query
- WordPress class, using add_action to call member function does not work
- Replace function in a child theme
- Limit number of posts in wp loop
- What is @Action in WordPress?
- How to rename custom taxonomy URL with extra words
- How to position user meta data field
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- How to create a custom taxonomy using a shortcode?
- Custom URLs in Custom Search Results
- Difference b/w Simple function call & do_action call
- jQuery does not work
- Display all posts that use a custom taxonomy
- jQuery code not working when included in functions.php
- Override Taxonomy Template
- Set tax_query conditionally with new WP_Query
- querying posts by custom taxonomy terms right from a querystring based URL
- Taxonomy Parent Name
- Custom taxonomy not appearing in menu administration panel
- Does using custom taxonomy is more CPU efficient than using meta_data?
- get_terms() duplicate first term of a custom taxonomy
- is_author(get_current_user_id()) returns false when author id and user id match
- How do I return all terms from multiple taxonomies?
- How to change url for taxonomy pages?
- Count Number of Posts in Taxonomy Term in Last 24 Hours
- Changing select options based on previous select with PHP & AJAX
- Search Query for Multiple Terms In Same Taxonomy
- Display author name, outside the loop, if they haven’t published a custom post
- How to access author data from header action
- WordPress implode & wp_insert_post question
- Output unique taxonomy terms of posts inside a loop
- Custom taxonomy pagination