Custom Post Type not saving taxonomies
-
Hello, all! I’m hoping someone can help me with a slight issue I’m having with a combination of plugins. The site in question acts as a business directory. The expected workflow is that a user will come to the site and fill out a form for a business they own which is submitted for approval by an editor before publishing. The form is built with GravityForms and includes inputs for neighborhood and business type, both of which are custom taxonomies.
Up until yesterday, things were working properly. The neighborhood form input is a select list and was populating properly as was the business type, which was a field of checkboxes. The plugins and versions that we were using:
- GravityForms (v1.9.16)
- Gravity Forms + Custom Post Types (v3.1)
- Gravity Forms: Post Updates (v1.2.23)
Yesterday afternoon, however, we upgraded Gravity Forms + Custom Post Types (v3.1.1) and noticed that the custom taxonomies are no longer saving. The form submits as normal with no error messages and the custom post type is correct in all other aspects, save the “missing” taxonomies.
After digging through the code, I threw a logging statement before each call to wp_set_object_terms I could find in our theme and all our plugins and I discovered what’s happening, though not how to resolve it. It appears that Gravity Forms: Post Updates has some functionality to remove all custom taxonomies during the gform_after_submission filter.
It appears that, previously (line 34), Gravity Forms + Custom Post Types hooked it’s save_taxonomies() function call to an action, gform_post_submission, that ran after gform_after_submission. However, the change to gform_after_create_post means that it runs before.
More simply, Gravity Forms + Custom Post Types is saving all the custom taxonomies and then, immediately after, Gravity Forms: Post Updates is deleting them all resulting in “missing” data.
I just discovered this last night and only gathered my thoughts this morning. I’m going to play around with moving around when the hooks fire, but I’m curious if anyone else has had this issue and, if so, what they did to resolve? It seems like this might be a genuine bug as I haven’t found anything in our theme that would alter the order in which these things should happen.
Any info would be appreciated. Thanks!
-M
https://www.ads-software.com/plugins/gravity-forms-custom-post-types/
- The topic ‘Custom Post Type not saving taxonomies’ is closed to new replies.