Don't show category counts from the future.
git-svn-id: https://develop.svn.wordpress.org/trunk@2270 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
322382ae61
commit
9c49e1b2a4
|
@ -279,12 +279,14 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||||
$categories = $wpdb->get_results($query);
|
$categories = $wpdb->get_results($query);
|
||||||
}
|
}
|
||||||
if (!count($category_posts)) {
|
if (!count($category_posts)) {
|
||||||
|
$now = current_time('mysql', 1);
|
||||||
$cat_counts = $wpdb->get_results(" SELECT cat_ID,
|
$cat_counts = $wpdb->get_results(" SELECT cat_ID,
|
||||||
COUNT($wpdb->post2cat.post_id) AS cat_count
|
COUNT($wpdb->post2cat.post_id) AS cat_count
|
||||||
FROM $wpdb->categories
|
FROM $wpdb->categories
|
||||||
INNER JOIN $wpdb->post2cat ON (cat_ID = category_id)
|
INNER JOIN $wpdb->post2cat ON (cat_ID = category_id)
|
||||||
INNER JOIN $wpdb->posts ON (ID = post_id)
|
INNER JOIN $wpdb->posts ON (ID = post_id)
|
||||||
WHERE post_status = 'publish' $exclusions
|
WHERE post_status = 'publish'
|
||||||
|
AND post_date_gmt < '$now' $exclusions
|
||||||
GROUP BY category_id");
|
GROUP BY category_id");
|
||||||
if (! empty($cat_counts)) {
|
if (! empty($cat_counts)) {
|
||||||
foreach ($cat_counts as $cat_count) {
|
foreach ($cat_counts as $cat_count) {
|
||||||
|
|
Loading…
Reference in New Issue