register_activation_hook and updating

I have used:

register_activation_hook(__FILE__, 'CrayonWP::install');

In install() I would like to check the plugin version being installed, and if it is below a certain version, I would like to alter the existing database model to the new format. How would I determine the version being installed?

Related posts

Leave a Reply

1 comment

  1. register_activation_hook() is only called when the user activates the plugin. It is not called after a plugin upgrade.

    The preferred method of handling upgrades is using register_activation_hook() to store the current version in the wp_options table and then checking it on each admin page load.