Make WordPress Core

Opened 8 years ago

Closed 4 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:


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)

comment:1 @santosj8 years ago

  • Component changed from General to Template

comment:2 @regulatethis8 years ago

This is still happening as of r7383

comment:3 @regulatethis8 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

comment:4 @regulatethis8 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.

comment:5 @Denis-de-Bernardy6 years ago

there's a related bug over in feeds, -- last updated wrong for category feeds, or something like that.

comment:6 @Denis-de-Bernardy6 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

comment:8 @ryan6 years ago

  • Milestone changed from 2.9 to Future Release

comment:9 @jdub6 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. :-)

comment:10 @solarissmoke4 years ago

  • Keywords close added
  • Version changed from 2.9.1 to 2.3

Think this can be closed on the back of #19953 - the argument has not been supported since WP 2.2.

comment:11 @SergeyBiryukov4 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.