• Hello,

    I’ve seen mention of optiondates generating a mysql error in earlier 1.5 versions, but I’m experiencing this issue with 1.5.2.

    When I use optiondates as follows in my sidebar:
    wp_list_cats(‘optioncount=1&exclude=1&list=0&optiondates=0’);

    It generates the following error:
    WordPress database error: [Unknown column ‘cat_ID’ in ‘where clause’]
    SELECT category_id, UNIX_TIMESTAMP( MAX(post_date) ) AS ts FROM wp_posts, wp_post2cat WHERE post_status = ‘publish’ AND post_id = ID AND cat_ID <> 1 GROUP BY category_id

    Warning: Invalid argument supplied for foreach() in /usr/share/wordpress/wp-includes/template-functions-category.php on line 303

    WordPress database error: [Unknown column ‘cat_ID’ in ‘where clause’]
    SELECT category_id, UNIX_TIMESTAMP( MAX(post_date) ) AS ts FROM wp_posts, wp_post2cat WHERE post_status = ‘publish’ AND post_id = ID AND cat_ID <> 1 GROUP BY category_id

    Warning: Invalid argument supplied for foreach() in /usr/share/wordpress/wp-includes/template-functions-category.php on line 303

    It does show an incorrect date however. It appears beside my blog name as 1970-01-01.

    template-functions-categories.php appears as follows:

    if ( $optiondates ) {
    $cat_dates = $wpdb->get_results(” SELECT category_id,
    UNIX_TIMESTAMP( MAX(post_date) ) AS ts
    FROM $wpdb->posts, $wpdb->post2cat
    WHERE post_status = ‘publish’ AND post_id = ID $exclusions
    GROUP BY category_id”);
    foreach ($cat_dates as $cat_date) {
    $category_timestamp[“$cat_date->category_id”] = $cat_date->ts;
    }
    }

    From what I can find on www.ads-software.com, the above is the corrected version (cat_ID replaces with category_id). Is this still a bug?

    Thanks.

  • The topic ‘wp_list_cats optiondates=1 generates mysql error in WP 1.5.2’ is closed to new replies.