Is it possible to wrap code in a special function that only executes the first time the plugin is activated?
I have some database code I need to run on plugin activation, but the code need not run again after that.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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: