'post_type'和'tag__in'不能很好地协同工作

I am having problems grabbing related posts by tag from all post types. I am using the following code below:

<?php
  $tags = wp_get_post_tags($post->ID);
  if ($tags) {
    echo 'Related Posts';
    $first_tag = $tags[0]->term_id;
    $args=array(
      'tag__in' => array($first_tag),
      'post__not_in' => array($post->ID),
      'showposts'=>5,
      'caller_get_posts'=>1,
      'post_type' => array('food','travel')
    );
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo '<ul>';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
      <?php
      endwhile;
      echo '</ul>';
    }
  }
?>

It does not return the correct posts but displays the latest posts instead. I've checked a dozen times on the WP documentation and my syntax is correct.

If this is a bug, does someone out there has a patch for this? Or another option is if you can share an SQL query approach.

Disable all plugins. Look in plugin files for add_action('pre_get_posts',...

This action sometimes replaces $my_query->query_vars['post_type'] with "any".

To me it was Sticky Custom Post Types plugin.