[wp-hackers] Does the term_taxonomy count get updated for future posts?

Callum Macdonald lists.automattic.com at callum-macdonald.com
Thu May 1 15:05:37 GMT 2008


Can anyone confirm if this is true? Any suggestions on how to fix?

Cheers - Callum.

Otto wrote:
> This may be the result of another bugfix gone awry.
>
> I recall a bug in trac where future posts would cause the count to
> update immediately instead of when the post transitioned.. Perhaps the
> "fix" only did half the job?
>
>
> On Mon, Apr 14, 2008 at 4:41 AM, Callum Macdonald
> <lists.automattic.com at callum-macdonald.com> wrote:
>   
>> G'day,
>>
>>  It appears that the wp_update_term_count() function is only called within
>> the wp_delete_object_term_relationships() and wp_set_object_terms()
>> functions. For the post_tag and category taxonomies, the
>> _update_post_term_count() function is called to update the count.
>>
>>  This function uses the following SQL query:
>>  SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE
>> $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status =
>> 'publish' AND post_type = 'post' AND term_taxonomy_id = '$term';
>>
>>  This query only counts terms which are applied to published posts.
>> Therefore, it does not count any terms where the post_status is future. That
>> makes sense.
>>
>>  However, I can't find anywhere when the wp_update_term_count() function is
>> called when a post is transitioned from future to publish status. So, in
>> theory, if a user published a whole bunch of future posts and then didn't
>> post anything else, the term_counts would never be updated.
>>
>>  I'm pretty sure this is correct, and therefore a bug, but I'm not
>> absolutely 100% confident, so I haven't filed it in trac yet. Can anyone
>> confirm if this is correct, or if in fact I've missed something?
>>
>>  Cheers - Callum.
>>
>>  _______________________________________________
>>  wp-hackers mailing list
>>  wp-hackers at lists.automattic.com
>>  http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>     
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
>   



More information about the wp-hackers mailing list