WordPress.org

Ready to get started?Download WordPress

Forums

Bugfix: Category counts do include "private" posts when logged in (1 post)

  1. tadekp
    Member
    Posted 8 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags