What you call “slugs” here is more appropriately called terms. It is a little confusing with native taxonomies because it turns into tautology: individual categories are terms of the category taxonomy.
So sports
and tech
are terms of native category
taxonomy.
The function arguments operate on taxonomy level, not term level. That is you need to provide a taxonomy slug, such as category
, and all of the terms in that taxonomy will be considered for a match.
From arguments point of view one of the options here is to use $excluded_terms
argument to exclude everything but the one term you want.
Other than that it’s pretty low level function, which directly generates a lot of custom SQL. There are abundant filters for manipulating that part of the process, like get_{$adjacent}_post_join
and get_{$adjacent}_post_where
, but it’s not something I would call easily adjustable.
Related Posts:
- adding custom fields to next and previous post link
- WordPress previous_post_link exclude posts with multiple categories
- Exclude Posts From Specific Category from Next and Previous post links
- Show category from “Next post” and “Previous post” [edited]
- previous/next_post_link in the same sub-category?
- Previous/next post links displaying wrong category than is desired
- Link to the next/prev posts in index loop in same category?
- Single.php Category Post Count
- Get next post in same category not working WP 4.7.4
- Post in multiple categories do not include in previous / next post if one category in excluded
- Change next_post and previous_link to navigate throught parent categories only
- how to implement next/prev within category archive?
- How to display non-hierarchical taxonomy as terms with checkboxes?
- get_categories for custom post type with a specific custom taxonomy attached
- Could not insert term into the database
- Combine two taxonomies in a hierarchical tree
- Weird behaviour when adding terms/term_taxonomies programmatically
- How can I select a primary category?
- How to Override default update_count_callback for category
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- How to get the number of child categories a specific parent category has?
- Update taxonomy value of post type in query
- How can I convert some categories to a custom taxonomy?
- Any way to assign Post Categories and Tags to Links?
- Display name of the last child category
- Want to hide some categories from the categories meta box in the post editor for the two specific user roles
- How to export/import categories and keep their IDs?
- How to use wp_category_checklist()?
- Get all sub-categories of a parent category
- How to view WordPress’ default category IDs?
- Random taxonomy category list
- Change existing taxonomy settings when using custom taxonomy
- Show Available Taxonomy List with Current Category
- category filter doesn’t work in WPML
- Exclude a category from the_category in the single post page
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- Get Prevous/Next Post Specific Category Without Excludes
- Display specific categories by ID
- Filtering *out* a taxonomy from the admin post list
- category image taxonomy
- Drop posts from categories in MySql
- Customize category page for different custom taxonomies
- How can I improve this taxonomy treating approach?
- Get posts under a category with SQL
- Custom taxonomy template for categories
- Display custom taxonomy attached to the post on post single page
- How to display parents category and child category separately for a specific post?
- Admin: Navigation Menus do not show empty categories/taxonomies in the list’s search tab
- Display sibling categories on category page
- How to display a value inside a post with a specified category from a category custom field? [closed]
- Echo text using is_tag
- Grandchild Term Things Grandfather Term is It’s Parent
- WP 4.7 in_category change?
- Get posts of a custom post type from category from taxonomy?
- Illegal string offset ‘taxonomy’ in
- Same menu for different taxonomies to reach different content
- Change categories count to include media attachments
- Show next post in same category but start from the latest
- How to get selected taxonomy or category ID if using custom walker?
- Let user select their own category
- How could I write a get_categories_by_year() function?
- Get posts in a subcategory of a chosen parent
- Natural sort / ordering wp_dropdown_categories
- Best way to categorize/populate a magazine style layout
- sidebar troubles, taxonomy trouble
- Displaying posts of given category
- WordPress Default Category and Custom Taxonomy Selected Attribute not Working After Searched in wp_dropdown_categories Array
- Automatically adding tags and categories into Post Excerpt for searching
- How can i add service category here? [duplicate]
- Show subChild categories
- How can i change sort category view starting from child then parent, not alphabetically
- WordPress 5.4 and higher: Filter posts by category 1 AND category 2 in API requests
- How to set the same base url for two different taxonomies?
- Limit categories to hierarchal depth of 2
- Show the parent taxonomy by creating shortcode in woocommerce?
- WordPress Portofolio Conditional Templating – functions php
- Parent Category and Subcategory default text generated with category
- Get WooCommerce product category list in functions.php
- Post List by category and under custom taxonomy
- Confused about category.php template – not working
- Filter custom taxonomy posts via AJAX
- Create duplicate category page with content variations
- Renaming default category taxonomy?
- How to Manage and link certain custom taxonomy?
- Display Taxonomies in loop with template args
- How to add a post with new Taxonomy without assigning to default category?
- Match two taxonomies to display a specific content
- Display only the latest post
- Problem importing categories and sub-categories
- list taxonomy based on taxonomy
- get IDs from links categories
- Multiple Parent Category URLs
- Show parent-child relationship for categories in the wordpress admin
- Converting Categories (with ACF fields) to custom taxonomies
- Taxonomy term RestApi data 10 rows limitions
- Order Categories by Character Count
- Images as Categories
- hide_empty property not working when using get_terms
- Quick Edit on taxonomy names results in error
- How to make /category/ URL load properly instead of 404 error?