1) 它是tag__in
(两条下划线)2)get_the_tags()
返回对象数组,您需要ID:
if ( $the_tags = get_the_tags() ) {
// https://developer.wordpress.org/reference/functions/wp_list_pluck/
$the_tags = wp_list_pluck( $the_tags, \'term_id\' );
}
$rel_pst = get_posts( array(
\'tag__in\' => $the_tags,
\'exclude\' => $post->ID,
\'post_per_page\' => 4,
\'ignore_sticky_posts\' => true,
\'post_type\' => array(
\'ms\',
\'gnd\',
\'events\',
\'news_article\',
\'opinions\',
\'projects\',
\'tenders\',
\'videos\',
\'products\',
),
));
if ( $rel_pst ) {
// Do your thing
}