Craft Query by Category and Tag I am trying to find the last four Channel entries (Named: Post) with a Category relatedTo "Support" (id: 458) AND Tag relatedTo: "Widget1" (id: 469)
I've had success using Category or Tag but not both:
This Craft Query works for Category

for entry in craft.entries.section('Post').relatedTo('458').orderBy('postDate desc').limit(4).all()


How can I add the dynamic Tag to the Craft query? The dynamic Tag matches the slug of the current page "widget1" or slug of another page "widget2".

Thank you.
You'll probably want to read up a bit on relations in the Craft docs, but I think something like this should work

{# First get the category elements #}
{% set supportCategory = craft.categories().id(458).one() %}
{% set widgetCategory = craft.categories().id(459).one() %}

{# Now we use those elements in our query #}
{% set entries = craft.entries().section('Post').relatedTo(['and',
  { element: supportCategory },
  { element: widgetCategory }
]).all() %}

{% for entry in entries %}
  {# ... your code #}
{% endfor %}


I believe the relation needs an element, but you might be able to do something like .relatedTo(['and', 458, 459]).