If you have a custom post type and a custom taxonomy assigned to it, you do not need to handle the saving of those terms yourself, WordPress already does this for you. So you can remove your taxonomy save code.
Also you should put your register_post_type and custom taxonomy registering code inside a function, and attach it to the init
hook. It’s not safe to just declare them outright.
Related Posts:
- How can I set taxonomy programmatically
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- How to hook save-post function to use taxonomy term in post-slug?
- How to use wp_set_object_terms depending on page ID?
- Remove Custom Taxonomy Metabox from Custom Post Type Screen
- Get terms by taxonomy AND post_type
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- Get Custom Taxonomy ID within loop
- Custom Post Types not showing on Custom Taxonomy archive page
- custom post type or taxonomy
- Remove Trash / Delete option for Custom Post Type / Taxonomy
- How to filter custom post types by custom category taxonomy
- Highlight menu item when on a custom post type?
- Changing the priority of a custom taxonomy’s metabox
- How to setup a Custom Taxonomy Term template
- Admin to user notices – best practices?
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- Custom Taxonomy List links being re-written
- front end radio custom taxonomy with custom post type
- Limit taxonomy results to a single cpt
- Bulk 301 redirect for custom post type
- Associate Taxonomies Across Post Types
- ‘category__and’ for custom taxonomy?
- Custom post query by taxonomy
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- How can I show recent posts from same taxonomy as the post currently being viewed?
- Display custom post type category taxonomy
- How to make a custom taxonomy selectable in post publish area?
- Only show posts from a certain category?
- Remove standard meta boxes from custom taxonomy
- List Post Title by Last Word Then Second Last
- Custom Post Type / Two level deep taxonomy (cat. and subcat.) uri problem (error 404)
- Customize Query for post
- Correct classes for WordPress menu items
- How can I see a list of my Custom Post Types of the last term I was in?
- Tax query not producing any results
- Display post as term id
- How to filter wp_list_categories output with some custom post type meta query?
- Removing custom post type slug from URL
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Sitemap generation
- Advanced search form with filters for custom taxonomies
- Why cant I add a custom post type to a custom taxonomy?
- Show Custom Taxonomy title in loop
- WP the_posts() on single-cars.php get category link
- tax_query not working in template
- Custom Post Type Dilema – How do I categorise by country?
- Custom post type’s extra fields – how to handle?
- Main query not querying any posts in custom taxonomy template
- Filter posts by tax (dropdown) and meta value
- Display custom taxonomy on my custom post type
- List Categories (wp_terms) and count posts
- Not able to export large no. of posts in csv
- Can I query posts by taxonomy conditionally based on post type?
- Which file/template is in charge of taxonomies for custom post types?
- Custom Post Types not queried in Custom Taxonomy archives or Native archives
- Show current custom taxonomy
- How to get dropdown instance value in WordPress custom Widget
- Include custom post type custom taxonomies in Categories widget
- Changing CPT slug and taxonomy already registered in parent theme
- Show post count number assigned to custom taxonomy
- Get Terms from Custom Taxonomy and Current Post
- Catch and display error on save_post action
- Check when the post type changes, and display content
- Loop and add Specific Categories and Products Images
- custom post archive URL is wrong
- custom post type or taxonomy, which approach is better?
- Custom Post Type with Different Sets of Post Content?
- Add a class to a div if custom post type has specific terms?
- Custom post type paging return home page
- Basic CPT Question About Categories
- In child theme, add CPT to custom taxonomy registered in parent theme
- Custom taxonomies not displaying in some custom posts
- Custom taxonomy returns 404 even with saving permalinks
- Static Front Page not working for custom theme
- WP_Query to display number of custom post type filtered (order by) taxonomy
- Custom post type shortcode with taxonomy attribute not working and no errors
- Live search by custom tag
- Set a Default CPT taxonomy by taxonomy id
- Custom taxonomy terms registered not showing when added in child theme
- Redirect Custom Post Type from Child Taxonomies
- Custom post edit page permalink links to edit page rather than the post
- Not Able to List CPT Based on Taxonomy Term
- Custom meta box data not saving
- Show tags of custom post types in WordPress
- Show posts for current taxonomy
- Display all Custom taxonomy terms and their relevant custom posts
- WordPress get all post with like in terms [duplicate]
- Best way to group posts based on custom post type terms
- Query Pulling the same post twice
- Cannot retrieve Custom Taxonomies (Disappeared)
- Render custom taxonomy query as single template
- Custom meta-box for all custom post types
- Loop multiple taxonomy in custom post
- Remove custom taxonomy ‘post-type’ from post URL
- Custom My account page and custom page for editing posts
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Require Custom Taxonomy for Custom Type
- Get all active posts that are tied to a custom taxonomy for a custom post type
- Taxonomy Archive URL + Template