Plugin code changed but can't undeclare class
-
Hi,
I am using a plugin which has updated recently for the flickr api authentication change. However the plugin class seems to be loaded into memory and it doesn’t look like you can undeclare a class!
The class is declared with:
if ( !class_exists('myClass') ) { class myClass { } }The plugin update has changed this class (new links stored in variables), but because it has already been declared the new class code never gets read. I proved this with echo statements, and I can see that the object instantiated has the old class variables set.
I am using wordpress which is hosted by my provider. I do not have the ability to restart my server. My wordpress is at the latest version. I have tried disabling the plugin and reactivating it. I have also tried deleting it completely and reinstalling (via FTP and via the worpress page). Nothing has worked. I even tried changing my php version on my web server! This class is declared and does not want to let go 🙁
I have hacked my way around it by renaming the class and updating any reference to the new name, this loading the new class code. This seems unnecessary and I am sure there must be a way around this.
Does anyone know how I can unload this class and reload the new one?
Thanks,
Stewart
The topic ‘Plugin code changed but can't undeclare class’ is closed to new replies.