2011-12-09 36 views
0

与えられた著者IDのステータス(公開、保留中など)を持つすべての投稿をクエリする方法を教えてください。Wordpress投稿者IDによって投稿を取得

<?php    
$loop = new WP_Query(array(
    'post_type' => 'photo', 
    'posts_per_page' => 12, 
    'orderby'=> 'menu_order', 
    'author' => $user->data->ID, 
    'post_status' => '???', //what should I put here 
    'paged'=>$paged 
)); 
?> 

ステータスとして新しいものを提供しますか?私はこれを訪問しました(リンクhttp://codex.wordpress.org/Post_Status_Transitions)、これは「新しい」 - 以前の状態がないときに得ました。私は新しいものとしてステータスを設定し、私の問題を解決しました。しかし、私はそれが将来何か問題を起こすかどうか分からないのですか?それは永遠にすべての記事を表示しますか?私はWPでの経験はほとんどありません。私を助けてください。

+0

が正常に動作していないかを説明してくださいしようとするだろう。 – Aurimas

+0

サンプルコードはhttp://www.livexp.net/wordpress/how-to-list-wordpress-posts-by-author.htmlを参照してください。 – JimmyPena

答えて

1

http://wordpress.stackexchange.comにお尋ねください。彼らはそこでのWP APIの質問についてより良い傾向があります。私は自分で刺すだろう。

docsによれば、以下の値が有効です。誰もが間違っているものを見るためにコードをテストすることができますし、それはちょうどそれを調べて間違っているものを見ることは困難だ - 私はany

'publish' - a published post or page. 
'pending' - post is pending review. 
'draft' - a post in draft status. 
'auto-draft' - a newly created post, with no content. 
'future' - a post to publish in the future. 
'private' - not visible to users who are not logged in. 
'inherit' - a revision. see get_children. 
'trash' - post is in trashbin (available with Version 2.9). 
'any' - retrieves any status except those from post types with 'exclude_from_search' set to true. 
関連する問題