get_terms()
got an upgrade in WordPress v4.6 so you can use the news WP_Term_Query
class instead. You can use this to simply exclude the ID of the term archive
so that it never becomes part of your results to begin with. So say the ID of archive
is 5:
$args = array(
'taxonomy' => 'category',
'exclude' => 5,
);
$term_query = new WP_Term_Query( $args );
if ( ! empty( $term_query->terms ) ) {
foreach ( $term_query->terms as term ) {
// What you want it to do
}
} else {
echo 'Term Not Found';
}
The 'exclude'
argument can be an array too so if you wanted to exclude IDs 5, 10, and 15 you just replace 5
with array( 5, 10, 15 ),
Related Posts:
- Exclude Specific Term from Search
- Retrieving custom taxonomy in order, but excluding specific tax IDs
- Exclude taxonomy term from all loops, but having it on widget
- Using WP_Query and Query_post for the loop?
- get_the_term_list without links in 3.1
- Custom columns on edit-tags.php main page
- get_term_children for immediate children only (not grandchildren)
- Custom taxonomies capabilities
- Can’t get a custom template taxonomy page to display
- Creating a non-removable taxonomy term
- Can I turn off write-in tags/taxonomies?
- Is it possible to use one slug for Multiple Taxonomies?
- Is it possible to add taxonomies to user profiles?
- Get terms from multiple taxonomies
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- How to restrict on selecting child taxonomy
- How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)
- Is it possible to sort the post based on a custom field?
- How do I get terms as a list for a specific post?
- get taxonomy terms for parent and child
- On Taxonomy Template page, want to add Post_Type
- Separator for multiple terms
- The next_posts_link() show me a aditional page in blank
- Help building array hierarchically with taxonomies (to get posts)
- Removing the base “Author” or changing it to something else. is it possible?
- What are terms and taxonomy, how they related to post and how these three are stored in database?
- Get multiple term objects by ids
- Echo custom taxonomy term name
- Next and Previous links on a single taxonomy page only link to same term
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- Move terms from one taxonomy to another keeping the hierarchy
- How can I get WP to build a feed based on multiple taxonomy terms
- Get custom taxonomy description with paragraph tags
- Getting the selected terms for custom taxonomies in the editor
- Change permalink of post if it belongs to custom taxonomy
- Get pages only with a specific taxonomy
- Set custom post type terms by id without knowing taxonomy
- Share taxonomy between user and posts?
- How to determine the depth of a term in a custom taxonomy?
- How do I Use Multiple Loops with WP_Query?
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- How to obtain the link/URL to the feed of a custom taxonomy?
- get_term_children doesn’t return an array of children terms
- Term count by user
- Catchable fatal error on custom category post
- How to add contents of a custom field to a taxonomy term list?
- Google Map Shortcode for Custom Taxonomy/Post Types
- Querying two taxonomies
- How to target parent product category and its children using WooCommerce?
- Custom taxonomy query is empty. 0 = 1 in SQL
- How do you reorder the custom taxonomies on the right side of a custom post edit page?
- Query posts by taxonomy with current term
- Custom Taxonomies not retaining hierarchy while importing from one site to another
- What is the most efficient way of implementing a notification system? [closed]
- Remove custom taxonomy column from my custom post type columns
- Get posts by Taxonomy without terms
- Check if custom taxonomy has posts with get_categories()
- How to add images to taxonomy terms? [duplicate]
- Echo custom taxonomy slug
- Remove a href from this code
- Adding a second custom taxonomy to a custom post type (both shown in its table)?
- custom post type, hide or disable the status line in publish meta box
- Get post terms from multiple custom taxonomies
- Terms Per Page in custom taxonomy Admin
- How to get attached image to taxonomy..?
- delete term from taxonomy and assign in new one
- How to get list of only custom taxonomies?
- Show single Child Category on Custom Post
- Only display latest custom taxonomy post
- Need equivalent of single_term_slug
- unable to save custom taxonomy terms in a custom-built metabox in wp-admin
- How to group non-hierarchical tags?
- Multiple Drop-Down custom taxonomies search
- How to combine taxonomies into URL?
- Issue adding custom taxonomies to custom post type (PHP)
- Taxonomy URL rewrite whilst keeping filtered posts?
- Add terms to a taxonomy archive from within the same taxonomy
- Show recent posts from a custom taxonomy in wordpress
- Fill New Taxonomies
- How do I show the parent term on a custom taxonomy template (not the ID)?
- Display taxonomies for custom post type
- Custom Taxonomy – Dropdown
- How to show selected check box vendors on front end home page?
- Error 404 in Custom taxonomy with pagination
- Need help understanding a rewrite with multi-level taxonomy
- custom taxonomy don’t return a value
- Change Permalink to Value of Custom Field
- Where to put a migration script to switch post information?
- Gravity prerender taxonomy [closed]
- Advanced search: roles and multiple taxonomies
- One taxonomy template for all categories?
- Get post terms with hierarchical relationships
- Removing fields from category/taxonomy edit form
- Error in Custom Taxonomy UI
- Remove ‘portfolio’ from URL
- Taxonomy to display form after creation
- How home my code doesn’t display any feature image? Looping through post from a taxonomy and not getting feature images back
- Add taxonomy fields of posts into RSS feed
- Add text in custom taxonomy
- How do I check if a post has a term with a particular ancestor/parent?