Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the List Category Posts plugin, and it isn't listing posts marked private, even if the appropriate user is logged in. Is there a fix for this?

share|improve this question

1 Answer 1

List Category Posts plugin uses get_posts to actually get the posts and its default post_status is publish and that is way you won't get any private posts.

To "Fix" it you can edit the file named include/CatList.php of the plugin and add

$lcp_query .= '&post_status=private';

before line 51 before

$this->lcp_categories_posts = get_posts($lcp_query);

this will get you only private posts and to really "FIX" it you need to add this code:

if(is_user_logged_in()){
    parse_str( $lcp_query, $lcp_query );
    $lcp_query['post_status'] = array('publish','private');
}

on line 51 again before

$this->lcp_categories_posts = get_posts($lcp_query);

and offer the author of the plugin this as a patch so the next time he updates you want lose this fix.

share|improve this answer
    
Hey, thanks for this answer! I'll add this into the next release of List Category Plugins. Thanks a lot for helping out! –  Fernando Briano Mar 20 '11 at 18:07
    
@Fernando: Glad i can help. –  Bainternet Mar 20 '11 at 18:34
    
Thanks @Bainternet! And thanks @Fernando for making this great plugin. –  Senior Mar 25 '11 at 15:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.