(I'm actually using 3.0.3, but the popup can't count that high).
In any case, I have written a plugin that lists posts within a page or a post, so the implementor can mix static content with dynamic. No big deal, but very, very useful.
I need to extend this to allow posts to be listed if they are part of a series, in the excellent organize-series plugin. I already have this working for categories. I haven't (yet) extended it to tags, but I need to do this for series.
Here's the code of what I am trying:
$posts = get_posts(array('numberposts' => -1));
foreach ( $posts as $mypost )
{
$should_list = false;
if ( function_exists ( taxonomy_exists ) && taxonomy_exists ( 'series' )
&& function_exists ( get_series_ID )
&& is_array ( $options['series_list'] )
&& count ( $options['series_list'] )
)
{
$terms = wp_get_object_terms ( $my_post->ID, 'series' );
foreach ( $options['series_list'] as $series_term )
{
$ser_ID = get_series_ID ( $series_term );
if ( $ser_ID )
{
$series_term = $ser_ID;
}
The problem is in this line:
$terms = wp_get_object_terms ( $my_post->ID, 'series' );
The 'series' term exists, and lots of posts are tagged with various tags.
However, I ALWAYS get an empty array as a function return from wp_get_object_terms. I have tried wp_get_post_terms, everything.
The $my_post is not within the loop. It can't be. We're already inside another post.
I'm sure that I'm making some boneheaded mistake. Anyone able to set me straight?