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.