Support » Plugin: CSV Importer » Creating Duplicate Category after WP upgrade to 4.1.1

  • Hi,

    I am huge fan of your CSV Importer Plugin and using it on my website previously it was working in a superb manner. In last few days, I have to go thru a wordpress upgrade from 4.0.1. to 4.1.1 during change in my hosting services. After this upgrate in WP, CSV Importer plugin is creating duplicate categories. Now It creates a new category with the same name (slug name changed) even that category already exists. Please advise me how to overcome this problem. Are you releasing your new version fully compatible with wp 4.1.1 or pls suggest me something so the I can fix this issue.


Viewing 1 replies (of 1 total)
  • Hey,

    I noticed the same thing with custom taxonomies. I looked into this problem and got it working again for custom taxonomies, the same fix should work for categories (but you will need to test).

    This is what happened:

    WordPress changed the way that the term_exists() function works. In particular the default has been changed from 0 to null. What this means is that if you pass in 0 the behavior is now different and it will look for the parent with id = 0. (changing behavior of inputs is generally a nono as it will break code that relies on stuff like this :/)


    In this plugin it relies on the fact that the 0 will bypass checking for the parent. When a 0 is passed in now it checks to see if there is a child matching with a parent of id = 0.

    This is the fix that I added, it hasn’t been heavily tested but works in the scenario that I am using.

    For the following line in create_terms():

    $child_info = $this->term_exists($child, $taxonomy, $parent_id);

    I replaced that line with the following:

    if ($parent_id === 0) {
    $child_info = $this->term_exists($child, $taxonomy, null);
    else {
    $child_info = $this->term_exists($child, $taxonomy, $parent_id);

    There is some code below that relies on the fact that the $parent_id is 0. so changing the $parent_id to null when no parent is found will cause some side effects.

    Please note that the term-exists() function is overridden in the file so removing the $parent_id from the term-exists() function call will cause it to be set to 0 and give the same incorrect response.

    Hope this helps diagnose for anyone having this issue because at the moment child categories and child taxonomies won’t work with the 0 or empty i.e. “0,cat” like it used to.


Viewing 1 replies (of 1 total)
  • The topic ‘Creating Duplicate Category after WP upgrade to 4.1.1’ is closed to new replies.