Support

Account

Home Forums General Issues 4.3.1 removes some images from custom taxonomy

Solved

4.3.1 removes some images from custom taxonomy

  • One of my sites just updated to 4.3.1 and some of the images associated with terms in a custom taxonomy, added with ACF fields, have disappeared.

    I thought it was probably just a display issue, but the affected terms have actually had their images removed in the database.

    I rolled back to a backup and everything was fine, updated all plugins and still everything was fine. As soon as I apply the 4.3.1 upgrade the same terms lose their images.

  • That happens to me as well. I’ve lost Category Images, Headers and Meta tags. I believe there’s a bug somewhere…

  • I’m glad i’m not alone then!

  • I realize that this may require you to update and roll back again, but…

    What is the term_id of the term/category before the update and what is it after the update?

    Do the affected term/category names exist in more than one taxonomy?

    Are you updated from 4.3.0 to 4.3.1. or from 4.2.something?

  • Hi there,

    Speaking for myself, luckily I have a test environment where I tried everything before upgrading. So the production site is ok as I didn’t upgrade.

    I am migrating from WP 4.1.1 so it may also be an issue due to how WP handles upgrades, or to a plugin which makes use of ACF or anything else.

    I don’t know how to get term_id’s unluckily but I may try to find them with some advice.

    The affected terms exist in more than one category.

    One more note: Not all the field values are deleted, it seems that nearly 10% of them is still filled …

    Bye
    I.

  • The affected terms exist in more than one category.

    My guess is that this has something to do with term splitting. This started in 4.2 and was forced in 4.3. What this means is that WP looks for terms that are in multiple taxonomies. If it finds any it splits them creating two terms with the same name but they now have different term_id values.

    If you edit a term or category you will see the term ID in the URL, for example tag_ID=10

    All of the data is in there but it’s now associated with the wrong term ID, so ACF can’t find it.

  • Hi John,

    Is there any DB table I can look into? like wp_term_taxonomy or something similar?

    Ivan

  • I’m not sure, the information on this says that WP will store the spit terms, I’m guessing in the options table, but I don’t know for sure.

    There is a hook that’s fired when a term is split so that plugins can correct.

    This was the first announcment https://make.wordpress.org/core/2015/02/16/taxonomy-term-splitting-in-4-2-a-developer-guide/

    and this was the second https://make.wordpress.org/core/2015/06/09/eliminating-shared-taxonomy-terms-in-wordpress-4-3/

    WP considered shared terms a edge case and basically left it up to the developers.

  • Well, I just run a query before and after the update to WP 4.3.1 selecting a single row for a field that seems to be missing after the update and the row it’s still there… I found no duplicates with the same option_id or option_name so I really don’t understand what’s happening.

  • ACF stores the custom fields for terms in the options table. It will still be there, but the option_name will be wrong.

    Lets say that you have the same term name my_term both categories and tags and that the id of this term is 10.

    Lets say you have a custom field named ‘image’ attached to the category term.

    ACF would store this value with the option name category_10_image that is {$taxonomy}_{$term_id}_{$field_name}

    Now lets say that WP splits the term and when that happens the term_id of the term in tags stays the same ‘10 but the term id of the term in categories changes to 20.

    The image is still stored with the same option_name category_10_image, but the ID value is wrong and the option name should be category_20_image. The field does not appear because ACF is looking for the second one but that one does not exist. With the way acf stores the field key there would also be a value with the options name of _category_10_image that should be _category_20_image

    At least, this is what the problem is if this has something to do with term splitting. The only way to know this would be to set up a site on WP 4.1 or before that has terms in multiple taxonomies, set up some custom fields, look at what the term_id values are before updating and then update and look at the ids after.

    I know this isn’t helping you solve your problem, and I can’t be sure if this is the problem.

  • Here is a plugin that will solve the problems with splitting terms and ACF.

    This plugin needs to be installed prior to updating any shared terms in WP version 4.2 or later.

  • Thank you so, so much John, that fixed the problem for me, I’ve been able to successfully update to 4.3.1 with no loss of custom field entries using the plugin!

  • Thank you John, that worked for me as well!

  • Just to let you know I backlinked your plugin and this thread from WP support forum.

    Thank you again John

  • I spoke to the developer. He did add support for term splitting back in ACF 5.2.0. This may be why not all of the category data was missing and I don’t know why any of it was missing, but during testing I did see some term fields not get updated. Anyway, my plugin can’t hurt anything to have it in place as a precaution. It only run when the split term hook is run.

  • Well, actually your plugin worked both for me and zigzagad so I think it’s worth using it…

  • I agree, I’ve already installed in on all the sites I maintain. I have a lot of client sites to worry about and there may be something particular that causes the problem; better to be safe than sorry. I also put in in the mu-plugins folder so they couldn’t deactivate it. The last thing I need is my coworkers screaming at me because the clients are screaming at them because data is missing in 100+ product categories. Our updates usually trail behind a bit, we usually don’t update until after the first WP minor update in a series, like 4.3.1.

    To test the plugin and get it working I set up a test site with only WP and ACF installed and I created many duplicate terms in tags and categories and an ACF field group attached to both of them. Then I took the site through the update process from 4.0 to 4.1 to 4.3 to 4.3 several times. Basically it took me about 10 hours to get it working and most of that time was spend reverting the site to 4.0 and going through the update process.

    The place I found the most errors with data missing was happening after updating to 4.3. The actual update does not cause the terms to be split. This actually happens when you open a term to edit it. When you do this it appears that WP looks at all of the terms in the current taxonomy, sees if any of them shared in another taxonomy and splits off the terms in the other taxonomy instead of splitting off the terms in the taxonomy you’re editing the term in.

    Heh, I’m weird so for me it was actually a fun exercise, and it was something I was a bit worried about and needed to do.

Viewing 18 posts - 1 through 18 (of 18 total)

The topic ‘4.3.1 removes some images from custom taxonomy’ is closed to new replies.