WordPress.org

Ready to get started?Download WordPress

Forums

2004-03-01: categories bug (5 posts)

  1. sberg
    Member
    Posted 10 years ago #

    I can't find this mentioned anywhere else on the message board, and it hasn't been fixed through several nightly releases, so... creating a category with no parent (or just editing the General category, since it has no parent) causes a database error:
    UPDATE wptest_categories SET cat_name = 'General', category_nicename = 'general', category_description = '', category_parent = WHERE cat_ID = 1

  2. Bard09
    Member
    Posted 10 years ago #

    I know what you mean... that bug has been around for at least 3-4 nightly builds!
    The quickfix if you know PHP is to find line 126 in wp-admin/categories.php and change category_parent = $cat to category_parent = '$cat' . $cat doesn't return anything since there is no parent, but the devs forgot to include the apostrophes. There is a similar place in the same file with the same issue, but it may have been fixed.
    Hope this helps!

  3. ihad
    Member
    Posted 10 years ago #

    huh, the same bug report is just 4 lines below your post with almost the same subject line here in this beta forum.
    anyway you also need to edit line 52:
    $wpdb->query("INSERT INTO $tablecategories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', $cat)");
    to:
    $wpdb->query("INSERT INTO $tablecategories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')");
    $cat needs those ' ' too.
    if you get any more db errors then search for missing ' apostrophes near that error.
    hth
    ihad.

  4. Bard09
    Member
    Posted 10 years ago #

    Sorry ihad, didn't see the other post. There's multiple places with the missing apostrophes, though, so it's nice to have both lines in the same thread for future bug fixing.

  5. ihad
    Member
    Posted 10 years ago #

    it's rather sberg not you who had problems finding any mention of that bug ;)
    no worries.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.