您需要在WP_Query 需要查询任何其他post类型时的参数接受内置post类型post.
默认情况下,post_type 设置为post, 因此,当用户没有手动设置特定的职位类型时,WP_Query 将从职位类型查询职位post
此外,caller_get_posts 已经被弃用了很长一段时间了。如果您打开了debug,您会收到关于此的弃用通知。要使用的正确参数是ignore_sticky_posts.
我也不会使用$post 全球,因为它是不可靠的,为了可靠性,而不是使用$GLOBALS[\'wp_the_query\']->get_queried_object(). 你可以在my answer here
get_the_tags() 也比wp_get_post_tags() 因为后者需要额外的db调用。
最后一个音符,wp_reset_query() 与一起使用query_posts, 要与一起使用的正确功能WP_Query 是wp_reset_postdata()
本质上,您可以尝试以下方法
$post_id = $GLOBALS[\'wp_the_query\']->get_queried_object_id();
$tags = get_the_tags( $post_id );
if ( $tags
&& !is_wp_error( $tags )
) {
$args = [
\'post__not_in\' => [$post_id],
\'post_type\' => \'doing\',
\'tag__in\' => [$tags[0]->term_id],
// Rest of your args
];
$my_query = new WP_Query( $args );
// Your loop
wp_reset_postdata();
}