I’m wondering if there is a WordPress action (a.k.a. event) that fires when a plugin is first activated. What I’m after is a place where I can run a full range of tests for that plugin. I know I can run tests each time a plugin is executed (e.g. I can add my tests to the ‘init’ event: add_action(‘init’, ‘do_my_tests’); ), but what if some of the tests are lengthy, and it would significantly slow down performance if they were to execute on every page request? Is there an event or some way to tie into which would let me run some extended tests only when the plugin is first loaded? I want to be able to run a whole lot of tests and message the user if there was some problem with their setup.
A similar use case might be a plugin that creates its own custom database table — you want it to create this table when the plugin is first loaded. You don’t want to have to check for the existence of the custom database table on each page load.
Know what I mean? Anyone got some ideas?
- The topic ‘Event/Action for when you first load a plugin?’ is closed to new replies.