I'm having a difficult time saving the values of custom fields associated with a specific custom post type, Events, which has been created by Events Manager Pro (hidden link).
I have created a field group, Homepage Secondary Spotlight Field Group, which contains three custom fields. This group is associated with the Events custom post type. When I load an Event in the dashboard to edit it, change the values, and click Update, the values do not get saved to the database. If I try to update the values of the custom fields with other post types (such as Pages and a custom post type named "Homepage Spotlights") associated with the same field group, it works fine. Only Events fail.
I've enabled debugging and see a few messages in the log, but I'm not sure whether they are relevant to this issue:
[31-May-2024 22:24:02 UTC] PHP Deprecated: urldecode(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/saul/Documents/apache_sites/sac.test/wp-includes/formatting.php on line 5151
[31-May-2024 22:24:03 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /Users/saul/Documents/apache_sites/sac.test/wp-content/plugins/types/vendor/toolset/types/embedded/admin.php on line 168
[31-May-2024 22:24:13 UTC] PHP Warning: Undefined array key "post_type" in /Users/saul/Documents/apache_sites/sac.test/wp-content/plugins/events-manager/em-events.php on line 347
[31-May-2024 22:24:14 UTC] PHP Deprecated: key(): Calling key() on an object is deprecated in /Users/saul/Documents/apache_sites/sac.test/wp-content/plugins/events-manager/classes/em-event-post-admin.php on line 124
[31-May-2024 22:24:14 UTC] PHP Deprecated: reset(): Calling reset() on an object is deprecated in /Users/saul/Documents/apache_sites/sac.test/wp-content/plugins/events-manager/classes/em-event-post-admin.php on line 129
[31-May-2024 22:24:14 UTC] PHP Deprecated: key(): Calling key() on an object is deprecated in /Users/saul/Documents/apache_sites/sac.test/wp-content/plugins/events-manager/classes/em-event-post-admin.php on line 131
[31-May-2024 22:24:14 UTC] PHP Warning: Undefined array key 0 in /Users/saul/Documents/apache_sites/sac.test/wp-content/plugins/somervilleartscouncil.org-plugin/src/theme_legacy.php on line 126
[31-May-2024 22:24:15 UTC] PHP Deprecated: Automatic conversion of false to array is deprecated in /Users/saul/Documents/apache_sites/sac.test/wp-content/plugins/gravityview-calendar/includes/gutenberg/blocks/calendar/block.php on line 56
[31-May-2024 22:24:15 UTC] PHP Deprecated: rawurldecode(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/saul/Documents/apache_sites/sac.test/wp-includes/formatting.php on line 5151
This seems to be a compatibility issue with that plugin.
From the error log that you shared I do not see any Toolset-related addresses and most of them are generated from:
wp-content/plugins/events-manager/
But event that is not a factor as those are deprecation messages which are not breaking errors, deprecation messages are there to info you that if you update the PHP version to a newer one the code might not work.
That is why I do not think that the error log has relative information.
I created a clean installation of WordPress and Toolset which you can login here:
hidden link
I'd appreciate it if you could install the event plugin there and try to see if you add custom fields there it works?
Thanks for your response. I appreciate the link to the clean WordPress install.
Per your instructions, I installed the Events Manager plugins (Events Manager and Events Manager Pro), created a couple of custom fields, and added a test event (hidden link). When I saved the event, the Toolset custom field values were correctly saved to the database.
What's the next step to troubleshoot this issue? Do you need access to my site?
Thank you for testing that. So it seems not related to a compatibility issue as you could not replicate the same problem on the clean installation.
I suggest that you do as follows:
- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Event Manager (Pro), Toolset and its add-ons.
- Create a new Event and try to save the custom field entry and see if you can see the same issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.
If the problem persists, I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.
What if you try to disable the custom code for a moment and then try to save the post in backend. If you find it working then the previous developer only tell you that with what purpose the custom code you shared is added and if we try to do any modifications to it I fear it should not break other things.
Better you get in touch with the person who has your site domain knowledge and who knows what goes in and out and they would be the best person to guide you in right direction in this matter.
Thanks for your response. The way I identified the offending chunk of code is by doing exactly what you said: I disabled it and tried saving the post with custom fields, and the values were saved.
I'll try to get in touch with the previous developer to find out what's going on, but he has no knowledge of Toolset. Thanks for your help!