I'm developing a theme which uses the NHP Theme Options Framework to add some theme options. Naturally, the theme options framework creates a single row in the database to store the theme's options into.

If I create a child theme of the parent, it shares the same theme options as the parent, which leads me to my question:

Should a child theme share the same theme options row as the parent, or should it have it's own options row? Is there a reason why one would be better than the other?

If they are shared and you switched between the two themes, your options would be intact. This can be great if that was the intended behavior. On the other hand, you might go to great lengths to customize the child theme thinking it's independent, switch back to the parent and find your changes overridden. I'm having a hard time choosing one over the other. What are your thoughts?

1 Answer 1



Theme options should be stored as theme mods, using get_theme_mod and set_theme_mod.

Internally these map on to options, but it is the official way to store theme specific options, that way when you change themes you don't get clashes, and your settings are preserved for if you ever change back. It's the classic adage of "someone else solved that problem for me, it's their problem now"

But should you persist in using options, I would advise you prefix all your options with your theme name, and not to share options between child and parent. Setting a child themes options should not affect a site when moving back to a parent theme.

There may be cases when it is advantageous though, so exercise good judgement ( aka use set/get_theme_mod )

You can find more about this API here

  • Interesting, first time I've heard of get_theme_mod and set_theme_mod. I'll be checking those out in further detail very soon. I think I'm probably too far down the rabbit hole to change the way the theme handles it's options but I think I'll try to keep the parent's and child's options separate like you suggested. Just seems like less headaches.
    – Andrew
    Sep 26, 2012 at 9:54
  • There're more methods and hooks documented here: codex.wordpress.org/Theme_Modification_API Ironically despite everyone having examples of the API in their codebase, nobody has bothered to ask where WordPress stores the data for headers and backgrounds etc there aren't many blogposts floating around about it
    – Tom J Nowell
    Sep 26, 2012 at 9:58
  • 1
    It's the API that stays behind the "Theme Customizer".
    – kaiser
    Sep 26, 2012 at 10:02

Your Answer

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

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