• Is this the place to post bugs?
    I think this is a bug. Comes out when I create a subcategory with the same name as a mother category. For example:
    I have a mother category called Poetry
    I created a subcategory under My Readings called Poetry.
    Seems that it tries to insert the value in the same location with the mother category called Poetry.
    I’m not sure though, here is the error log:
    Database error: [Duplicate entry ‘Poetry’ for key 2]
    INSERT INTO wp_categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES (‘0’, ‘Poetry’, ‘poetry’, ”, ‘7’)
    Warning: Cannot modify header information – headers already sent by (output started at /home/premrara/public_html/wp-includes/wp-db.php:80) in /home/premrara/public_html/wp-admin/categories.php on line 56

Viewing 3 replies - 1 through 3 (of 3 total)
  • prara, as of now there can’t be two categories with the same name, regardless of where they are (nested / not nested).
    A workaround I found to this problem is to have a leading space before the second category you create with the same name .
    Like you have “poetry” and then ” poetry”.

    Thread Starter prara

    (@prara)

    OK thank you but I am not doing that it’s not pretty.

    samwilson

    (@samwilson)

    I’m getting this duplicate key error with version 1.5.2. I found this bug ticket on Trac which says that it’s fixed. But it isn’t. To fix it, you have to run the below SQL on your database. Use PhpMyAdmin or whatever.


    ALTER TABLE $wpdb->categories
    DROP INDEX
    cat_name,
    ADD UNIQUE cat_name (cat_name, category_parent);

    And I agree with prara, putting spaces before category names is not pretty! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Database error: inserting category values’ is closed to new replies.