Title: 該当するpost_idだけ取得したい
Last modified: 2017年7月5日

---

# 該当するpost_idだけ取得したい

 *  [realmccoyzz](https://ja.wordpress.org/support/users/realmccoyzz/)
 * (@realmccoyzz)
 * [9年、 4ヶ月前](https://ja.wordpress.org/support/topic/%e8%a9%b2%e5%bd%93%e3%81%99%e3%82%8bpost_id%e3%81%a0%e3%81%91%e5%8f%96%e5%be%97%e3%81%97%e3%81%9f%e3%81%84/)
 *     ```
       $args = array( 'category' => '3,1000,1002','post_type' => 'post' );
       $the_query = get_posts( $args );
       ```
   
 * 上記のようにget_postsを使うと、post_idのみならず記事本文なども含まれ、$the_query
   が膨大なデー多量になってしまいます。処理も遅いと思います。
 * あくまでpost_idだけ取得したい場合、簡単にできる方法があるのでしょうか？

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

 *  [ishitaka](https://ja.wordpress.org/support/users/ishitaka/)
 * (@ishitaka)
 * [9年、 4ヶ月前](https://ja.wordpress.org/support/topic/%e8%a9%b2%e5%bd%93%e3%81%99%e3%82%8bpost_id%e3%81%a0%e3%81%91%e5%8f%96%e5%be%97%e3%81%97%e3%81%9f%e3%81%84/#post-218912)
 * こんにちは
 * get_posts の fields パラメーターに ‘ids’ を指定すると ID のみの配列を取得する
   ことができます。
 * `$args = array( 'category' => '3,1000,1002', 'post_type' => 'post', 'fields' 
   => 'ids' );`
    -  この返信は9年、 4ヶ月前に[ishitaka](https://ja.wordpress.org/support/users/ishitaka/)
      が編集しました。理由: 誤字
 *  トピック投稿者 [realmccoyzz](https://ja.wordpress.org/support/users/realmccoyzz/)
 * (@realmccoyzz)
 * [9年、 4ヶ月前](https://ja.wordpress.org/support/topic/%e8%a9%b2%e5%bd%93%e3%81%99%e3%82%8bpost_id%e3%81%a0%e3%81%91%e5%8f%96%e5%be%97%e3%81%97%e3%81%9f%e3%81%84/#post-218960)
 * すっかり見落としていました。
    誠にありがとございます！

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

 トピック「該当するpost_idだけ取得したい」には新たに返信することはできません。

## タグ

 * [get_posts](https://ja.wordpress.org/support/topic-tag/get_posts/)

 * フォーラム: [使い方全般](https://ja.wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2件の返信
 * 2人の参加者
 * 最後の返信者: [realmccoyzz](https://ja.wordpress.org/support/users/realmccoyzz/)
 * 最後の活動: [9年、 4ヶ月前](https://ja.wordpress.org/support/topic/%e8%a9%b2%e5%bd%93%e3%81%99%e3%82%8bpost_id%e3%81%a0%e3%81%91%e5%8f%96%e5%be%97%e3%81%97%e3%81%9f%e3%81%84/#post-218960)
 * 状態: サポート関連の質問ではありません

## トピック

### 人気のトピック

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

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

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

### 未解決のトピック

### すべてのトピック
