WordPress.org

Ready to get started?Download WordPress

Forums

PDO (SQLite) For WordPress
post count of Cat/Tag were not updated under WordPress 3.0.1 (9 posts)

  1. shellex
    Member
    Posted 3 years ago #

    there is one little problem annoying me:

    wp_list_categories() and wp_tag_cloud() always return a empty string, no matter how i classify my posts or tag them.

    After a simple testing, I found this bug only affects the count of post in categories/tags, the search or archive functions work ok.

    I guess WordPress fail to update the count of categories/tags in SQLite.
    I don’t check the source of WordPress (or PDO Plugin), so I wrote some code to workaround.

    $categories= get_categories(‘hide_empty=0′);
    foreach ($categories as $category) {
    $option = ‘

  2. term_id ).’”>’;
    $option .= $category->cat_name;
    $option .= ‘
  3. ’;
    echo $option;
    }
    use code above to replace the wp_list_categories().

    http://wordpress.org/extend/plugins/pdo-for-wordpress/

  • fl5x
    Member
    Posted 3 years ago #

    I have the same annoying problem but I don't understand very well the workaround. Should I replace the code in wp-includes\category-template.php with this:

    $categories= get_categories(‘hide_empty=0′);
    foreach ($categories as $category) {
    $option = ‘
    # term_id ).’”>’;
    $option .= $category->cat_name;
    $option .= ‘
    ’;
    echo $option;
    }

    From where to where?

    Thanks

  • fl5x
    Member
    Posted 3 years ago #

    To show categories:

    Dashboard > Appearance > Widgets > Primary Widget Area > Show hierarchy

    I haven't found the way to show tags or just parent categories.

    Any ideas?

  • fl5x
    Member
    Posted 3 years ago #

    Well, the thing is that after publishing some posts both categories and tags seem to be working properly. Weird.

  • thinkweird
    Member
    Posted 3 years ago #

    use code above to replace the wp_list_categories().

    Which file is the wp_list_categories() located?

  • websign
    Member
    Posted 3 years ago #

    It's far easier solution - one character to change. Open file category-template.php (in wordpress wp-includes directory), find definiotion of wp-list-categories (about 452 line) and below in defaults array you'll find 'hide_empty' => 1, - change it into 'hide_empty' => 1, and that's it!

  • websign
    Member
    Posted 3 years ago #

    Of course it has to be changed into 'hide_empty' => 0, ;)

  • thinkweird
    Member
    Posted 3 years ago #

    Thank you websign it worked like a charm.

  • grandwazir
    Member
    Posted 3 years ago #

    This isn't a complete fix as the problem seems to be slightly deeper. Although this fixes catagories not displaying they will still report erroneous numbers of posts within them - always zero.

    The same can be seen on the administration interface in the category section. More annoyingly when deleting a category or adding a post to a category gives me this error:

    Warning: implode() [function.implode]: Invalid arguments passed in .../wp-includes/taxonomy.php on line 2799

    Looking for that section it appears to be a function called _update_post_term_count which is generating an SQL query for later use and it causing the script to fail.

    As for how to fix it I have no clue :/

  • Topic Closed

    This topic has been closed to new replies.

    About this Plugin

    About this Topic

    Tags