The @PieterGoosen’s answer saved my life:
add_action( 'transition_post_status', function ( $new_status, $old_status, $post ) {
if( 'publish' == $new_status && 'advert_tmp' == $old_status && $post->post_type == 'advert' ) {
$tags = get_post_meta( $post->ID, 'advert_tags_field', true );
$tags = explode( ',', $tags );
if( !empty( $tags ) ) {
wp_set_object_terms( $post->ID, $tags, 'advert_tag' );
delete_post_meta( $post->ID, 'advert_tags_field' );
}
}
}, 10, 3 );
Related Posts:
- List all the tags from a custom post type
- Find callback function for custom taxonomy metabox
- Show certain terms from custom taxonomy but exclude ‘parent’ terms?
- How to search from specific post type with tags?
- associate custom post type with tags with specific pages
- Is it possible to make tag archive page specific to Custom Post Type?
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- How to make a custom taxonomy selectable in post publish area?
- Add Tags to custom post type
- Can custom taxonomies items have attached properties?
- Change Permalink Structure for Tag.php template
- search also in taxonomy, tags and custom fields
- Listing tags from a custom post type
- Show all tags on custom post type
- Best way to specify “article type” in URL
- Display posts with tag for custom post type only
- How to list tags from custom post type attachments?
- Why does my taxonomy have a category style div id?
- portfolio custom type tags support
- How can I create an automatic drop down menu with my tags?
- display custom taxonomies limited to custom post type?
- The Difference Between Categories and Tags and Taxonomies and Terms
- Print all the tags from a custom post type
- add custom tags for custom post type in wordpress
- Advanced archive url structure (category, tag and date)
- Search CPT by tag ids
- How to set “section categories”?
- Tags being removed upon updates to related posts: ACF/Genesis/WP5.4.1
- CPT tags not showing when editing post
- How to add independent “Tags” to Custom Post Type?
- Custom Post didn’t display on tags page
- Custom Post Type tag taxonomy “Page Not Found”
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Loop multiple taxonomy in custom post
- Generating List of Tags from Custom Post Type
- Archive.php is not displaying tags
- WordPress Custom Post Type and sort by Tags
- get tags from custom post type
- Tags and Taxonomy links not working for Custom Post Types
- Attaching multiple custom taxonomies to one CPT?
- Can multiple custom post types share a custom taxonomy?
- How to Add Custom Fields to a Custom Post Type?
- limit selection of custom taxonomies to one?
- Filtering a custom post type by custom taxonomy in archive template
- $wp_query->queried_object->ID throws warning: Undefined property
- Load custom posts with same tag as page
- Custom Taxonomy Template Post List with Sort Order
- Post type archive page not working
- Help with hierarchical custom taxonomies and permalinks…almost there
- Archive or taxonomy pages not working for custom post type
- Custom Taxonomy returns no posts
- Display taxonomy term only if there’s a value
- How to get only one category of custom post type?
- Create separate template for shared custom taxonomy with shared terms
- Custom/separate categories for custom post type
- Custom Post Type Pagination & duplicate posts
- Connecting a taxonomy with a post type
- How to achieve representation of streets index with custom taxonomies
- Custom post types and permalinks
- How to filter custom taxonomy categories on archive?
- Fetch taxonomies by custom post type id array
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- Normal pages as children of my Custom Post Type
- Custom post type and taxonomy slug issue
- Custom template won’t load for a custom post type (custom permalinks used)
- Genesis filterable portfolio isotope [closed]
- Adding a custom post type taxonomy template in plugin
- Get parse_query filter to return slug instead of id
- Custom post type and taxonomy – show related posts
- Add custom image size for custom post type or taxonomy
- Can’t remove front from permalinks for custom taxonomy category page
- Custom Permalinks with CPT and Hierarchical Taxonomies
- How to make custom taxonomy into drop down select in a custom metabox
- Invalid argument supplied in register_taxonomy $args->taxonomies
- Custom Post Archive is not working
- Getting the taxonomy
- Wp Query with multiple custom tag(taxonomy) by get the terms
- Problems with custom taxonomies
- Widget Categories shows “No categories”
- How to display class name in this shortcode post query
- Taxonomy rewrite pagination 404
- Retrieve Custom Taxonomies with Description and Slug
- How to list posts by term (custom taxonomy)
- Use custom post type taxonomy between cpt slug and name
- How to properly set the rewrite rules for this case?
- Assigning categories to custom post types via a front-end form; only works for native post type
- How to order taxonomy terms by most recent post?
- Building Link List for Custom Tax
- Custom taxonomy template for custom fields loop [closed]
- Best way to have one product in both rental and sale parent category
- Associate custom CPT with another CPT’s taxonomy and rewrite permalinks
- Same permalink structure for all post types?
- WordPress custom post type
- How to have working breadcrumbs with several taxonomies associated with a custom post type
- How to Display Custom Taxonomies in an Un-ordered HTML List
- link posts to custom post type
- Most appropriate way to display CPT’s by children terms of custom taxonomies while retaining desired permalink structure?
- See the process of creating a taxonomy and tell me where I made a mistake
- Navigation won’t update to show full path to single post
- Advise on Custom Taxonomies and Structure