Answer the question
In order to leave comments, you need to log in
How to make get_posts() display posts by tag?
Is there any way to display posts by tag using get_posts()?
I tried like this but it doesn't work
$tag = single_tag_title('', false);
$product_list = get_posts("tag=$tag");
Answer the question
In order to leave comments, you need to log in
https://codex.wordpress.org/Template_Tags/get_post...
https://codex.wordpress.org/Class_Reference/WP_Que...
https://codex.wordpress.org/Class_Reference/WP_Que...
Specify not title and slug. Well, or ID. And the single_tag_title() function returns title, that is, the title.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question