Support » Plugins » Archive widget for private posts

  • Hi,

    The archive widget in WordPress does not show private posts, even if these are available to the logged in user.

    Is there any way to:

    a) include all private posts in the count, even if a user can’t access them


    b) include private posts which are visible to the user in the count?

    If there is a plugin with a widget with this functionality, that would also be great but I can’t seem to find one.



Viewing 2 replies - 1 through 2 (of 2 total)
  • For anyone else struggling with this, I found an answer. Put this in your theme’s functions.php

    function customarchives_where( $x ) {
    	return $x . " OR (post_type = 'post' AND post_status = 'private')";
    if ( is_user_logged_in() ) {
        add_filter( 'getarchives_where', 'customarchives_where' );

    If a user is logged in, the archives widget will now include private posts.

    Comments from any wordpress pros as to whether this is the best way to do this are more than welcome!

    Thks for this sharing

    But When I put your code, inside my functions.php file ,I doesn’t have the result expected with all widgets plugged on my right menu.
    These widgets are included with the basic version of WordPress 3.5.1 or with the jetpack package.
    I precise that all my articles are private
    For example, I can’t see the last articles or in the calendar of articles: there is no traces of my articles arranged by date

    May be , do you have any suggestions ?


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Archive widget for private posts’ is closed to new replies.