setup_postdata() and the_tags()
-
It doesn’t seem like the_tags() function is working correctly if you use setup_postdata() to retrieve the data on each posts.
The following works fine:
foreach ($posts as $post) : the_post();
and then you can call the_tags() and everything’s just fine.The following does not seem to work:
foreach($posts as $post) : setup_postdata($post);
the_tags() produces nothing when used in such foreach-loop.Why would you want to use the latter instead of the first example? Well, say you want to execute this:
$posts = get_posts('numberposts=3&category=12&orderby=post_date&order=DESC');
This is probably used by ppl who are using wordpress as a cms rather than just a blog. So the vanilla seems to work but if you step of the track just a little bit it seems to not work.
Could this please be confirmed or denied? Thanks much.
- The topic ‘setup_postdata() and the_tags()’ is closed to new replies.