2

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.

1
  • I think setup_theme is run on every page views.
    – julien_c
    Mar 6, 2012 at 14:17

2 Answers 2

1

You should read this: Activation/Deactivation hook for wordpress theme

1
  • 2
    Lone link is considered a poor answer since it is meaningless by itself and target resource is not guaranteed to be alive in the future. Please try to include at least summary of information you are linking to.
    – Rarst
    Jan 29, 2012 at 11:59
0

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.