Support » Everything else WordPress » sql-error in sidebar links after upgrade to 2.2.2

  • After upgrading from wp2.1.3 to 2.2.2 the links/blogrolls didn’t show up, instead I got the following sql-error:

    WordPress database error: [Unknown column ‘name’ in ‘order clause’]
    SELECT * FROM wp_categories WHERE cat_ID > 0 AND link_count > 0 ORDER BY name ASC

    After tracking down the problem I found the modified function call extract($r, EXTR_SKIP); in category.php:get_categories to be the reason.

    In wp 2.1.3 the EXTR_SKIP Parameter is not used.
    So I’m not sure if this is really a bug or if there is another reason, why the variable $orderby already exists with a (wrong) value of ‘name’?

    (I am runnung wp with PHP-4.3.2)
    Somebody else has seen this?

Viewing 15 replies - 1 through 15 (of 32 total)
  • I’ve got a virgin install of WP, 2.2.2, same problem. I don’t quite understand from your post what you changed after finding the EXTR_SKIP in category.php. Could you be enticed to give a little more detail on the fix, pretty please?

    Instead of modifying core code, you’d be happier either getting a theme that uses wp_list_bookmarks or converting your current theme to use the same.

    Handy, thanks! I’m actually trying to create a theme, and am following advice to start with default 1.6. It does seem odd that both themes which ship with the app have this problem on a virgin install.

    The new data I can add is that in default 1.6 the error clears when I navigate to a category; same for the 2-column-right-fluid “blank” theme from And I can manually change the query part of the address in the address bar, making it read, for example, ?cat=99, even though I only have two categories so far. In classic 1.5 none of this makes any difference, the error message is always present in the sidebar.

    Meanwhile I guess I’ll see what I can do with wp_list_bookmarks in default 1.6 and the blank.

    If you don’t have the wp_list_bookmarks in the sidebar.php of the default theme… then that’s NOT a “virgin 2.2.2 install” as you stated!

    hi I downloaded 2.2.3 for a virgin install yesterday and I have this problem also. I’m not really a coder. hpz did you mean we should change $orderby to $bookmarks ?? This may be a dumb question but I’d love to fix the problem. cheers

    Moshu, No need to shout or exclaim. It is not an upgrade. It was virgin on Friday when I installed it; I’d never monkeyed with WP before, been using blosxom. Since then I have deferred worrying about this sidebar db problem while I tried to figure out the spaghetti that was style.css in the default theme. The shipped themes are untouched; I work with copies. Line 57 of sidebar.php reads, omitting indentation:

    <?php wp_list_bookmarks(); ?>

    I said in my last note I’d look at HandySolo’s suggestions because that seemed more polite that saying I recalled seeing wp_list_bookmarks without first doing a little double checking.

    Since you’re a moderator, I’ll put the question to you directly, is it news to you that the shipped themes in 2.2.2 barf in the sidebar as described?

    hi I fixed mine! one of the other posts mentioned nmaes for funtions being changed! I’m using the 2.2.3 basic template (kubrick). in this template go to the ‘sidebar.php’ and down the bottom where it says <?php wp_list_bookmarks(); ?> replace line with <?php get_linksbyname(); ?>
    hope that helps someone! 🙂

    Addendum: The “blank” theme does not have wp_list_bookmarks anywhere in sidebar.php; default does. Both barf in the sidebar when there is no ?cat=N in the address bar; both are just fine if there is.

    On the other hand, both default and classic do have wp_list_bookmarks in their respective sidebar.php, but their behavior is different; nothing seems to keep classic from barfing in the sidebar.

    This would seem to be strong evidence that wp_list_bookmarks isn’t entirely relevant to the problem. Perhaps someone could explain hpz’s hack for us to use in the meantime?

    brookluder, Excellent; thanks! Mind telling us which thread in case there are other juicy tidbits?

    the thread was:

    and the page with the updated tags is here:

    brookeleuder, Do I understand correctly that our “fix” is to replace the new-for-2.1-forward wp_list_bookmarks with the deprecated get_linksbyname? I just plain would never have thought to try the deprecated tag, but props to you for figuring it out. 😉

    Also, perhaps for the wider audience, why does this yield a batch of linked names in my sidebar, for Donncha, Michel, Ryan, Matt, Mike, Alex, Dougal, each linked to an offsite page? Am I going to have to fish them out of the db? Or is there a better fix.

    Think I’m gonna have to just experiment with hpz’s tweak.

    ah no easy fix! the names are like the example “about” page! just go into the admin section and delete them from the Blogroll page!

    brookeluder, you totally rock. I’m plenty fine removing the demo blogroll data; just hadn’t realized that’s what I was seeing.

    For the blank theme I’m working with I had to replace get_link_list with the deprecated get_linksbyname; this fixed the frontpage problem (it was always fine if the query string identified category display.)

    Thanks again, brookeluder, for the clue.

    And now you need urgently to upgrade to 2.2.3 because there are publicly available exploits for hacking 2.2.2. Fortunately it’s a painless upgrade.

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘sql-error in sidebar links after upgrade to 2.2.2’ is closed to new replies.