Title: category error
Last modified: August 18, 2016

---

# category error

 *  Resolved [jbjaaz](https://wordpress.org/support/users/jbjaaz/)
 * (@jbjaaz)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/)
 * The following error appears in the sidebar where the list of categories should
   be.
 * > `Warning: Invalid argument supplied for foreach() in /www/location/news/wp-
   > includes/template-functions-category.php on line 309`
 * I think the problem started after upgrading to version 1.5.1.3
 * In the php, the code is simply
 * > `list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','')`
 * Any ideas how to fix this?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [jbjaaz](https://wordpress.org/support/users/jbjaaz/)
 * (@jbjaaz)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-263995)
 * anybody??? I have no idea why this is happening.
 * I just upgraded to the latest version and still get the same error.
 *  Thread Starter [jbjaaz](https://wordpress.org/support/users/jbjaaz/)
 * (@jbjaaz)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-263996)
 * okay I just noticed “wp_get_archives” doesn’t actually print out the archive 
   list either.
 * What could be wrong with my installation?
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-263997)
 * Try replacing that line in your sidebar with:
 * `<?php wp_list_cats('sort_column=name'); ?>`
 * It’s hard to tell without seeing your site, but you may need to surround it with
   ul tags, like such:
 * `<ul>
    <?php wp_list_cats('sort_column=name'); ?> </ul>
 * But, try the line without the ul tags first.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-263998)
 * > What could be wrong with my installation?
 * It’s [very] hard to tell without seeing your site.
 *  Thread Starter [jbjaaz](https://wordpress.org/support/users/jbjaaz/)
 * (@jbjaaz)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-264009)
 * whoops, sorry for the late response.
 * I added ‘sort_column=name’ but I still get the error.
 * The site is, [http://communitydevelopmentsc.org/news/](http://communitydevelopmentsc.org/news/)
 *  Thread Starter [jbjaaz](https://wordpress.org/support/users/jbjaaz/)
 * (@jbjaaz)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-264010)
 * here’s the relevant php code;
 * ` <h2>Categories</h2>
    <ul> <?php wp_list_cats('sort_column=name'); ?> </ul>
 *  <h2>Archives</h2>
    <ul class="last"> <?php wp_get_archives('type=monthly'); ?
   > </ul>
 *  Thread Starter [jbjaaz](https://wordpress.org/support/users/jbjaaz/)
 * (@jbjaaz)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-264013)
 * I’m at a loss. Anybody!
 * if I run “echo $wpdb->print_error();” I get the following
 * `WordPress database error: []
    SELECT cat_ID, cat_name, category_nicename, category_description,
   category_parent FROM wp_categories WHERE cat_ID > 0 ORDER BY cat_name asc
 * Which is weird because all posts print out correctly. I would think that means
   the database is accessible.
 *  Thread Starter [jbjaaz](https://wordpress.org/support/users/jbjaaz/)
 * (@jbjaaz)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-264014)
 * Okay, I seem to have “solved” the issue.
 * I had one user/pass setup for all databases on my server.
 * I added a new user/pass strictly for wordpress and the error went away, categories
   printed out and archives list printed out.
 * Now, I was doing the single user/pass for all databases just to make it easier
   to remember. Is it best practice to use a different user/pass for every database?
   Why did having a single user/pass cause problems for wordpress. I mean posts 
   printed out fine. Why were the categories and archives list any different?
 * Thanks for listening.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘category error’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [jbjaaz](https://wordpress.org/support/users/jbjaaz/)
 * Last activity: [20 years, 8 months ago](https://wordpress.org/support/topic/category-error-2/#post-264014)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
