Skip to main content
improved title
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459

Activation Hook timing question Call activation hook multiple times

Tweeted twitter.com/#!/StackWordPress/status/340331985182552065
Source Link
ahnkee
  • 75
  • 1
  • 6

Activation Hook timing question

I have a plugin that does some initialization stuff using register_activation_hook called from its __construct().

I've since extended my plugin to add functionality to it. For the sake of organization, I've moved the extended functions to it's own class. I need to create a table that will deal with data unique to this new class.

My new class is instantiated from the construct of my main plugin. And from the construct of my new class, I am trying to call register_activation_hook a second time to create my table. Not surprisingly, this does not seem to work. (I have tested my db creation code elsewhere and it does work).

Is there a way that I can hook into the register_activation_hook from my new class to ensure the database is created at activation, or maybe even piggyback onto the parent class somehow to make sure the db is created?