Title: get_commentsについて
Last modified: 2014年2月5日

---

# get_commentsについて

 *  [sana0211](https://ja.wordpress.org/support/users/sana0211/)
 * (@sana0211)
 * [12年、 9ヶ月前](https://ja.wordpress.org/support/topic/get_comments%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/)
 * いつもお世話になっております。
    いま、get_commentsでトップページに コメント一覧
   をつくりたいと思っています。
 * カスタム投稿ページとカスタムフィールドで
    ソートしたいのですが、フィールド値の
   部分で 躓いてしまっている状態です。
 * 下記のコードが現在の状態です。
 * <?php
    $args = array( ‘post_type’ =>array(‘livesch_one’,’livesch_many’), ‘status’
   => ‘approve’ , ‘number’ => 10, ‘meta_query’ => array( ‘relation’ => ‘AND’, array(‘
   key’ => ‘エリア’, ‘value’ => ‘東京’, ),), ); $comments = get_comments($args);
   foreach($comments as $comment): $post = get_post($comment->comment_post_ID); ?
   >
 * どなたか、間違っている部分を指摘していただけますと
    助かります。
 * よろしくお願いいたします。

1件の返信を表示中 - 1 - 1件目 (全1件中)

 *  [yousan](https://ja.wordpress.org/support/users/hogetan/)
 * (@hogetan)
 * [12年、 9ヶ月前](https://ja.wordpress.org/support/topic/get_comments%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/#post-172009)
 * 上記のコードだとコメントが表示されない、ということでしょうか。
 * 確認なのですが、エリアというメタ情報は記事のカスタムフィールドでしょうか？
    コメント
   にもメタ情報があり、get_commentsのmeta_queryはこちらを参考にしている気がします。
   [http://codex.wordpress.org/Function_Reference/add_comment_meta](http://codex.wordpress.org/Function_Reference/add_comment_meta)
 * 記事のメタ情報をもとにコメントを集めたい場合にはまた後ほど。
 * // get_commentsのmeta_queryを使ったことがないので参考までに。

1件の返信を表示中 - 1 - 1件目 (全1件中)

 トピック「get_commentsについて」には新たに返信することはできません。

## タグ

 * [カスタムフィールド](https://ja.wordpress.org/support/topic-tag/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89/)
 * [サブループ](https://ja.wordpress.org/support/topic-tag/%e3%82%b5%e3%83%96%e3%83%ab%e3%83%bc%e3%83%97/)
 * [get_comments](https://ja.wordpress.org/support/topic-tag/get_comments/)
 * [一覧ページ](https://ja.wordpress.org/support/topic-tag/%e4%b8%80%e8%a6%a7%e3%83%9a%e3%83%bc%e3%82%b8/)

 * フォーラム: [使い方全般](https://ja.wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1件の返信
 * 2人の参加者
 * 最後の返信者: [yousan](https://ja.wordpress.org/support/users/hogetan/)
 * 最後の活動: [12年、 9ヶ月前](https://ja.wordpress.org/support/topic/get_comments%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/#post-172009)
 * 状態: 未解決

## トピック

### 人気のトピック

### 返信がないトピック

### サポート関連ではないトピック

### 解決済みのトピック

### 未解決のトピック

### すべてのトピック
