I’m not sure why you’re seeing the ID increment, however one problem is that your function call to get_terms()
needs to include an array of taxonomy names as the first parameter.
In your case, you just need to include an array with a single taxonomy name. For example:
$existing_terms = get_terms(array('custom_taxonomy'), array(
'hide_empty' => false
)
);
When I ran your sample (without this array) I was getting an error response from the get_terms()
function.
Adding this array seemed to work as you described. More information on how to use get_terms()
.
Related Posts:
- 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
- Taxonomy, Terms, and Template Files
- 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?
- Sharing a custom taxonomy with Multiple custom post types
- Show Two custom Post type and their posts on category page
- Group custom posts by custom taxonomy names
- Change Permalink Structure for Tag.php template
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- Get post from custom post type order by two taxonomies
- How to convert custom post type based list to a dropdown list?
- Wrong request query on cpt and tax
- 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?
- Custom taxonomy rewrite give pagination 404
- 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
- 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
- custom post type and a “sticky” position taxonomy
- 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
- Ajax load more inside custom post type taxonomy
- Custom post edit page permalink links to edit page rather than the post
- Create a custom wp_query from a specific custom post type with specific taxonomy
- Not Able to List CPT Based on Taxonomy Term
- 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)
- Custom Post type and Taxonomy in post URL error
- 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
- How to Create Custom Post Type with Multiple Color Options?
- 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
- Problem with shortcode