Or wait wait wait… did you mean “tag” like the wordpress taxonomy? Because, if so, that’s a completely different query.
I suppose some cautions are in order:
*) never cache if you can’t measure the difference in performance (you won’t know if you are making things better or worse).
*) writing code for a wordpress theme tends to be different from writing code for a wordpress plugin.
*) if you’re doing this on a “multisite” (or have a strange configuration) that would also change the details of the query.
*) the code snippet I posted was intended to be in the body of a php function.
*) if you need this to be a part of the $wp_query, that introduces other issues (including things like the url structure that this fits into).
Anyways, if this doesn’t work, I would have to ask you for more information about what specifically you’re doing.
(And, if you’re using wordpress ‘tags’ (also known as the ‘term’ taxonomy), then maybe you should be doing some other things different. Like maybe it makes sense to have a video custom post type and have the tags on the videos rather than buried deep in the artist description?)
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.