How to check for already existing plugin versions on activation? and prevent errors

Question

If a user has a version of my plugin installed and activated, let’s say version 1.1
And I send the user version 1.2 and he tries to upload and activate the new version, what will happen is that they will get an error: “Failed to redeclare activate_function()”

I’m struggling to see how I can prevent this.
If I use class_exists or function_exists to check, that’s still not working, the newer version will run first, and then the older version will error out.

I just want to do it nice and smoothly without errors.
Thoughts?

0
, , Stefan S 5 months 0 Answers 76 views 0

Leave an answer