I’m writing a theme which has it’s own set of database tables.
I’m wondering what is the best action for me to use when I want my install function to be invoked only once when the theme is activated for the first time?
I know there is a setup_theme
action, but not sure if that’s the one I should use.
You should read this: Activation/Deactivation hook for wordpress theme
You could also try, since it’s an SQL issue, using
IF NOT EXISTS
in your query to ensure that it doesn’t run twice.