• Resolved Naomi Blindeman

    (@naomiblindeman)


    Hi, beautiful plugin, wonderful to see all the work on it and the simplicity with which it works. Thank you.
    I am/was using: WP 3.7.1. & polylang 1.2.1 & custom made theme
    I have an odd little problem. I had your plugin working, completely, on my site with the current theme.
    I added an archive template for a custom post type (archive-portfolio.php) that was already working without problems. The archive page didn’t work. I deactivated polylang to see if it might have something to do with that. The archive worked. I thought “aha”.
    I turned polylang back on thinking I’d just have to change a setting or the permalink structure to get it to work, and the english menu stopped working. (Default is dutch)
    The menu still exists, I try to choose the right location for it (Main menu in English), I click save. But it doesn’t commit the change.
    I made a new menu, doesn’t work either. There is another location available but all menu’s will only take the dutch/default locations and none of the English one.
    I’ve tried activating and deactivating the plugin again. Nothing changes.
    A new update came out of polylang, I updated, nothing changed. I can’t assign a menu to any of the english versions of ‘location’.
    I don’t know if I explained myself clearly but I hope so. Anyone who has a suggestion of where I might look: I’m open to them!
    Thank you.

    https://www.ads-software.com/plugins/polylang/

Viewing 5 replies - 46 through 50 (of 50 total)
  • Plugin Author Chouby

    (@chouby)

    What has to be unique is the set (object_id, term_taxonomy_id). So if (39, 156) does already exist, it of course can’t be created again. What’s weird is that I use the WP function wp_set_object_terms which does make all necessary verifications before attempting to insert the row in DB. And this same function is used by WP to affect a category to a post (that’s the reason of the test proposed).

    Is it possible for you to make a database dump and share a link at https://polylang.wordpress.com/contact/ ?

    I see, but that’s not the case. What SQL is complaining about is that there is already an object_id with the number 39.

    There is no record with object_id 39 and taxonomy_id 156.

    I think the problem is with the structure of wp_term_relationships .

    Yes, I deleted the index for the column object_id and now everything works fine.

    So the problem was that the column object_id from wp_term_relationships is set as an index column which forces that all records in that table to have a unique object_id number.

    Not sure if this is a WP issue or a polylang issue. Just letting you know.

    Thank you very much for all your help!

    Plugin Author Chouby

    (@chouby)

    This is how the table is created by WordPress:

    CREATE TABLE $wpdb->term_relationships (
     object_id bigint(20) unsigned NOT NULL default 0,
     term_taxonomy_id bigint(20) unsigned NOT NULL default 0,
     term_order int(11) NOT NULL default 0,
     PRIMARY KEY  (object_id,term_taxonomy_id),
     KEY term_taxonomy_id (term_taxonomy_id)
    ) $charset_collate;

    The primary key is on (object_id,term_taxonomy_id). If in your database, it was on object_id only then something was extremely wrong. That meant that you could set only one term to a post, for example only one category, or only one tag. Since Polylang sets the language before the translation group, the second insert breaks.

    I did not pay enough attention to the error message:
    '39' for key 'object_id'
    and not
    '39-156' for key PRIMARY

    One mistery is solved (another one is waiting on another topic).
    I learned something today…

    Now it’s set correctly for PRIMARY KEY (object_id,term_taxonomy_id). But yes, when the table was created, I think instead of PRIMARY KEY (object_id,term_taxonomy_id) it only did PRIMARY KEY (object_id) for some reason.

    It doesn’t matter now, it’s important that it is fixed. Thank you for your support, I wouldn’t have been able to track the problem without your help.

Viewing 5 replies - 46 through 50 (of 50 total)
  • The topic ‘Menu trouble after deactivating and activating’ is closed to new replies.