Buggy transients with Custom Post Types and custom metaboxes
-
I have a setup with multiple Custom Post Types (via Pods) that have extra metaboxes, and a theme that adds extra metaboxes, and metaboxes from the theme added to the CPTs through a filter in functions.php.
These extra metaboxes are all there on the CPT edit screens, no problems. But the Tabify setting screen is a mess: these ‘extra’ metaboxes were more or less randomly showing up after clicking, saving settings, or saving posts.
I tried to track down what was happening and found out the following factors in play:
– In detection.php, a transient is set for all extra metaboxes. This is where it goes wrong. Somehow these transients sometimes are set correctly and sometimes not or incomplete. On top of that, in the same script is a return for if a transient has been set. So if the transient is already set, but wrong or empty, the mess is complete and it does not change anymore.
– For me the only way to sort of fix all metaboxes was adding a delete_transient before the set_transient function. And to temporarily remove the return.
Then save a post for each post type (also confusing, otherwise it does not work). Then when all transients set correctly, re-set the return in the detection script.
– I am not sure why these transients are acting so buggy and why updating the transient does not seem to work consistently without deleting it first.
– I have read that object caching could also be in play, but I have not installed any caching yet.I also downloaded the latest version of this plugin (1.1.0) from github. I have seen that the whole detection script and transients are set up differently there. But the behaviour with this version was equally buggy. Not being sure of the status of these files, as they are not released yet, I reverted to 0.9.7 and more or less fixed it like above.
When I have new metaboxes now, I will go through the same manual procedure. Not very handy but it seems the only way.I hope this will get fixed in a new version.
- The topic ‘Buggy transients with Custom Post Types and custom metaboxes’ is closed to new replies.