Adding code to plugin that only executes the first time its activated?

Posted by Prem Tiwari | Updated on

If you want to add code in your plugin that only executes the first time when you plugin activate? Yes, this is possible. You can register a plugin activation hook that only gets run when the plugin gets activated. I dredged up an old plugin I wrote for some example code:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers