Your query arguments, formatted to be readable, look like this:
$args = array(
'taxonomy' => $taxonomy,
'term' => $term->slug,
'posts_per_page' => 1,
'orderby' => 'modified',
'category' => $str
);
That does not match any argument pattern I see for WP_Query. I think you are trying to construct a tax_query but that should look like this:
$args = array(
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $term->slug
)
),
'posts_per_page' => 1,
'ignore_sticky_posts' => true,
'orderby' => 'modified',
'category' => $str
);
I am not sure why you have a tax_query and a category argument. Perhaps that is a mistake, perhaps you want an AND or OR relationship between the taxonomies. I am not sure.
I suspect that you also want ignore_sticky_posts so I added that.
Related Posts:
- Taxonomy filter all children
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Can a Child Category Have More than One Parent?
- Combine two taxonomies in a hierarchical tree
- How can I select a primary category?
- How to get a list of term names of the custom post type im currently on in single.php
- How to Override default update_count_callback for category
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Getting WordPress custom taxonomy/category?
- Return category slug / title from category ID
- How to get the number of child categories a specific parent category has?
- Get term by slug in Gutenberg
- How to get the depth of a category’s subcategories
- How can I convert some categories to a custom taxonomy?
- Any way to assign Post Categories and Tags to Links?
- Best way to programmatically link to multiple categories (union/intersection) [closed]
- Code to pull in a PHP file named after the category ID
- 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()?
- in_category() works in single.php but not in page.php?
- Get all sub-categories of a parent category
- Can I use get_adjacent_post for specific categories?
- Implementing a tricky wordpress menu (nested categories + thumbnails)
- Change existing taxonomy settings when using custom taxonomy
- Second level subcategory
- How to get the id from the custom category?
- category filter doesn’t work in WPML
- How to filter out Categories for specific post types on WordPress Admin?
- query in category.php repeats itself
- How can i insert term in a specific language of Polylang?
- Filtering *out* a taxonomy from the admin post list
- category image taxonomy
- How to “group” (categorize) the Pages together?
- Is There a Difference Between Taxonomies and Categories?
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Custom taxonomy/category order
- Woo Framework: woo_cat_featured not populating
- How can I improve this taxonomy treating approach?
- Targeting Parent Category Pages
- Create menu locations for each category in wordpress
- get_terms function not returning anything
- Category title output before opening title tag
- How to display parents category and child category separately for a specific post?
- Include WooCommerce product to all child categories
- Notice: Trying to get property of non-object in : custom fields category
- WP REST API not retrieving all categories
- How to display a value inside a post with a specified category from a category custom field? [closed]
- Grandchild Term Things Grandfather Term is It’s Parent
- Eliminate word from $term->name
- What Must to Display the “mysite.com/category” URL?
- Get posts of a custom post type from category from taxonomy?
- Style a category from category list
- Same menu for different taxonomies to reach different content
- Change categories count to include media attachments
- 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
- Categories from front-end, checkbox selection doesn’t work
- How to get posts using category slug in ClassiPress?
- Best way to categorize/populate a magazine style layout
- Explode() expects a string
- get_the_category – display only a single category for a post (not all categories)
- display category with background color
- Disable Category Taxonomy
- Automatically adding tags and categories into Post Excerpt for searching
- How can i add service category here? [duplicate]
- How to set the same base url for two different taxonomies?
- Limit categories to hierarchal depth of 2
- How to set acf color field as background color to product category
- How to target all woocommerce categories that don’t have any subcategories in them?
- Show the parent taxonomy by creating shortcode in woocommerce?
- WordPress Portofolio Conditional Templating – functions php
- Parent Category and Subcategory default text generated with category
- Post List by category and under custom taxonomy
- get taxonomy list in a page in the wordpress
- Number of categories slowing down the site
- Multiple if statements with else for get_the_category [closed]
- Create duplicate category page with content variations
- Renaming default category taxonomy?
- How to echo Tags and Categories as plain text
- How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?
- Display List of Categories Within a Custom Taxonomy
- How to add a post with new Taxonomy without assigning to default category?
- foreach,having wp_query inside, breaks after showing one result
- Category foreach Paging
- Taxonomy for custom post type not found
- Why is my post categories not displaying?
- Problem importing categories and sub-categories
- list taxonomy based on taxonomy
- Call Current Category
- Multiple Parent Category URLs
- category & sub category order issues in wordpress
- Show parent-child relationship for categories in the wordpress admin
- Taxonomy term RestApi data 10 rows limitions
- Order Categories by Character Count
- Is there a way of displaying related posts from lowest hyrachical order (lowest child category to parent category)
- How to limit number of posts in the certain category and exclude the oldest post automatically
- How can I get the categories and subcategories separately?