Hello,
as the title says, i’m trying to retrieve a field named “meta_desc” on my tag.php template.
$term = $wp_query->get_queried_object();
$identifier = "tag_".$term->term_id;
$description = get_field('meta_desc',$identifier);
=> $identifier seems correct (is tag_XXXX), but $description is always empty, it’s driving me mad, what did I miss ?
(i’ve tried this code directly in tag.php, and into functions.php as well, and same results everytime, always empty).
! Found the solution : I should have used post_tag instead of tag.
That’s not very intuitive, but glad I stumbled upon a reference in the Codex.
Eliott, I suggest you add this in the get_field documentation, it’s rather clear for category_ID, but not for tags, and I can’t be the only one trying to do that 🙂
Cheers,
Baptiste