You should hook onto the save_post action.
add_action( 'save_post', 'add_video_taxonomy' );
function add_video_taxonomy( $post_id ) {
// you should check if the current user can do this, probably against publish_posts
// you should also have a nonce check here as well
if( get_post_meta( $post_id, 'video_url', true ) ) {
wp_set_post_terms( $post_id, 'video', 'your_custom_taxonomy_name', true );
}
}
Related Posts:
- Get value in custom field with taxonomy [closed]
- Outputting an array of term meta values in a custom WooCommerce tab?
- Print terms with taxonomy and metabox value
- Can I use a Custom Meta Value inside of ‘get_the_terms’?
- How to add contents of a custom field to a taxonomy term list?
- How to support fifteen thousand terms in WordPress?
- Extra Meta Data for WordPress Multisite Taxonomy
- How to use custom slug and custom templates for custom taxonomy?
- Count tags for current post and save into custom meta field (and update it on post edit)
- Create new Taxonomy, add extra fields, register terms AND extra fields values?
- Remove Custom metabox from particular page template is used
- How to filter a taxonomy meta field to the ‘single_term_title’ filter hook
- Taxonomy Extra Meta [duplicate]
- get_posts assigned to a specific custom taxonomy term, and not the term’s children
- How can I get only parent terms?
- Retrieve posts by term id custom query
- Change order of Custom Taxonomy List
- Get the the top-level parent of a custom taxonomy term
- get_the_term_list without links in 3.1
- Inserting terms in an Hierarchical Taxonomy
- get_terms – only top level
- How to only list the child terms of a taxonomy and not their parents?
- Is ACF being a honey trap? [closed]
- Hierarchical taxonomy UI
- How to prevent new terms being added to a custom taxonomy?
- Add default WordPress tag meta box to User Profile
- Order get_terms using a Custom Field
- Add custom taxonomy fields when creating a new taxonomy
- get_term_children for immediate children only (not grandchildren)
- Query users by custom taxonomy and user role
- Determine Term depth
- How to get current term in my custom taxonomy in WordPress?
- Is there a way to ‘Lock’ a Taxonomy?
- Order get_terms() By Custom Field
- Hide the term description on the term edit page, for a given taxonomy
- Order terms by term_order
- get_term_by not working when in functions.php
- How to modify the query in taxonomy-custom.php to sort term archives by a custom meta field?
- Custom taxonomy hide meta box but show in menu
- Creating a non-removable taxonomy term
- Get second level terms of custom taxonomy
- Can I lock down custom taxonomies on a parent term level, but not a child term?
- Get only the first term by taxonomy
- Exclude specific slug in ‘get_terms’
- Large taxonomy (2000+ terms), causing WordPress to hang
- Custom order of terms for custom taxonomy in admin and website
- How do you remove a Category-style (hierarchical) taxonomy metabox?
- Is there a way to disable a term rather than deleting it?
- Modify Term Update Redirection
- Best pratice to make taxonomy terms translatable without changing slugs?
- Front End Post Save Child terms
- Return only the custom sub-term for custom post type, do not echo term-parent
- wp_insert_term is adding a term that has no name
- Taxonomy slug by term ID
- Check if current term is a child of another term
- Is there a way to import terms into WordPress?
- get_terms() doesn’t return empty terms even though hide_empty is false
- Get terms from multiple taxonomies
- Remove Category description textarea
- Get taxonomy name of current post
- Formating the_terms() function output
- Add description to custom taxonomy admin metabox
- get_terms() returns an empty array
- wp_insert_term auto unique name
- get_terms showing link to category even if all posts are drafts
- Determine if Term has Grandparent/Great-Grandparent
- Custom metabox for menu administration page?
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- Dropdown: Display terms from B only if has relationship with a term A selected
- Custom Fields and performance
- register_rest_field for custom taxonomy fields that are assosiated with custom post type
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Retrieving custom taxonomy in order, but excluding specific tax IDs
- wp_get_object_terms – How can I order the resulting array by hierarchy?
- Get main parent categories for a product
- Get current term’s ID
- Is it possible to get a Previous/Next Taxonomy term archive URL?
- Is it possible to sort the post based on a custom field?
- How to select one major category (or custom taxonomy) for a custom post type?
- Showing posts by collection of specific terms and texonomy
- Custom taxonomy – custom sortable column
- get taxonomy terms for parent and child
- Taxonomy query for children of parents
- show term description instead of list terms of custom taxonomy
- meta_box or custom_field as a second tinymce post-instance?
- WP_insert_term how to insert multiple values as taxonomny term?
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Group posts that matches a term in a loop
- How to display submenus on page based on referring top-level parent?
- Get the term id belonging to custom taxonomy on a custom single-post-type.php template page
- term_link() filter or rewrite and howto?
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- Display Custom Taxonomy Terns ordered by meta_value
- Separator for multiple terms
- Contact Form 7 – Populating dropdown list with terms relative to the post
- Custom Taxonomy terms with latest post ordered by date pagination issue
- How to set hierarchical terms to a post using wp_set_object_terms
- Echo taxonomy term meta on author.php
- get_the_term_list without specific category
- Hierarchical display of custom taxonomy