针对特定自定义字段值发布帖子

I want to get post who have custom field value 'Rap' against custom text field 'music-type'

$artists = array( 'posts_per_page' => 50, 'offset'=> 0, 'meta_key' => 'music-type', 'meta_value' => 'Rap', 'order'=>'ASC' );
$artists_lst = get_posts( $artists); foreach ($artists_lst as $post ) : setup_postdata( $post );
$post_id=$post->ID;
<li><a href="#"><?php echo $post_id; ?></a></li>
<?php endforeach; ?>
</ul>

Solved issue, using get_pages instead of get_posts.

Per https://codex.wordpress.org/Function_Reference/get_post_custom_values I would try:

$artists = array( 'posts_per_page' => 50, 'offset'=> 0, 'meta_key' => 'music-type', 'meta_value' => 'Rap', 'order'=>'ASC' );
$artists_lst = get_posts( $artists);
foreach ($artists_lst as $post ) : 
  setup_postdata( $post );
  $post_id=$post->ID;
  if( get_post_custom_values( 'music-type',  $post_id) == "Rap" ):?>
  <li><a href="#"><?php echo $post_id; ?></a></li>
  <?php endif;
endforeach; ?>

The function info page reports that it returns an array, so you may need to push it into a variable before comparing. Like:

$music_type = get_post_custom_values( 'music-type',  $post_id);
if($music_type[0] == "Rap"):?>

Hope that helps.