WordPress.org

Support

Support » Requests and Feedback » Bugfix: Category counts do include “private” posts when logged in

Bugfix: Category counts do include “private” posts when logged in

  • Hi,
    Just to report a small bug and submit a bug fix.

    Problem:
    When logged in (on the blog page) the categories in the sidebar are not updated correctly (i.e. items posted as private are not counted), although both published and private posts are displayed when the user clicks on the category).

    Solution:
    Just a one-line fix (ok, two lines) in wp-include/template-functions-category.php:289
    $cat_counts = $wpdb->get_results(” SELECT
    (…)
    WHERE post_status = ‘publish’
    (…)

    to:
    WHERE ( post_status = ‘publish'”. (($user_ID)?” or (post_status=’private’ AND post_author = $user_ID)”:””) . “)
    and declare “global $user_ID” somewhere before.

    Cheers,
    Tadek

  • The topic ‘Bugfix: Category counts do include “private” posts when logged in’ is closed to new replies.
Skip to toolbar