Opened 17 years ago
Closed 13 years ago
#5028 closed defect (bug) (wontfix)
wp_dropdown_categories and wp_list_categories with show_last_update=1 displays wrong date
Reported by: | MichaelH | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.3 |
Component: | Template | Keywords: | close |
Focuses: | Cc: |
Description
The show_last_update=1 parameter, when used with wp_dropdown_categories, shows 1970-01-01 for all categories.
$wp_version = '2.3-RC1';
$wp_db_version = 6124;
It works in 2.2.3.
Change History (11)
#3
@
17 years ago
I've narrowed this down to this line in wp-includes/classes.php:
$output .= ' ' . gmdate($format, $category->last_update_timestamp);
It appears that the $categories object that is passed to the walk_category_dropdown_tree() function does not include last_update_timestamp...
Below is sample output from my installation...
( [term_id] => 1 [name] => Uncategorized [slug] => uncategorized [term_group] => 0 [term_taxonomy_id] => 1 [taxonomy] => category [description] => [parent] => 0 [count] => 1 [cat_ID] => 1 [category_count] => 1 [category_description] => [cat_name] => Uncategorized [category_nicename] => uncategorized [category_parent] => 0 )
#4
@
17 years ago
- Cc regulatethis@… added
Now that I think about it, what exactly does the "last update" to a category refer to?
The last time an item was posted to that category? The last time the category itself was edited? Not sure... But looking through these functions and the db I can't imagine where the last_update_time would be divined from.
#5
@
16 years ago
there's a related bug over in feeds, -- last updated wrong for category feeds, or something like that.
#6
@
16 years ago
- Summary changed from wp_dropdown_categories with show_last_update=1 displays wrong date to wp_dropdown_categories and wp_list_categories with show_last_update=1 displays wrong date
closing #5029 as it's the same thing for wp_list_categories
#9
@
15 years ago
- Cc jdub@… added
- Version changed from 2.3 to 2.9.1
I whipped up a cheesy little plugin to add the 'last_update_timestamp' column back in, albeit on the term_taxonomy table -- it used to exist on ye olde categories table. The field is updated when a post is published into that term (so this will work for any kind of term, which is a nice bonus).
Once those are in place, show_last_update=1 works (because it now has a date to show!), as per line 1370 in wp-includes/classes.php.
(My cheesy plugin also provides helper functions to return update-sorted terms because the core doesn't -- yet!)
Not sure if this is super-appropriate for core, but at least describes how to fix the problem, and notes some more general benefits of resolving the bug in this manner (generic "last update timestamp of any term" support).
Thanks. :-)
This is still happening as of r7383