我找到了解决方案
<?php
$costumepost = "12709";
// args
$args = array(
\'numberposts\' => -1,
\'post_type\' => \'post\',
\'cat\' => array(18),
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'costumeid\',
\'value\' => $costumepost,
\'compare\' => \'=\'
),
)
);
// query
$the_query = new WP_Query( $args );
?>
<?php if( $the_query->have_posts() ): ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php echo get_post_meta($post->ID, \'artist\', true); ?><br>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query();?>