Display all post meta keys and meta values of the same post ID in wordpress

前端 未结 6 1682
长发绾君心
长发绾君心 2020-12-23 17:10

I\'m trying to display post meta values and post meta keys, If only one value is to be display I can used the simple function get_post_meta() but what I need now is to post

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-23 18:00

    $myvals = get_post_meta( get_the_ID());
    foreach($myvals as $key=>$val){
      foreach($val as $vals){
        if ($key=='Youtube'){
           echo $vals 
        }
       }
     }
    

    Key = Youtube videos all meta keys for youtube videos and value

提交回复
热议问题