php - Get all posts related to a specific taxonomy in WordPress
one text
<?php $terms = get_terms([
'taxonomy' => 'artists',
]);
if (!empty($terms)) {
foreach ($terms as $term) {
echo $term->name;
echo "<br><br>";
}
}
?>
Any one knows how can I display the songs for a specific artist on click?
In other words, how to get the id of the clicked element in order to iterate over the taxonomy and get the specified element?
As far as I am concerned, the elements found inside a taxonomy don't have an id?
Example: The user clicked on Roddy Rich, How to iterate over the taxonomy and get that element?
Source