0

I have a theme that when installed will check to see if the necessary pages are there and if not they will be created (this is for a website not a blog). I'm trying to create settings that will be updated from false to true once each page has been created so that functions.php isn't continuously checking the page's existence.

I've looked into global variables (which is advised against) and register_setting which requires a form. I don't want settings that are visible or can be modified manually but only by the code.

closed as too broad by TheDeadMedic, Pieter Goosen, Wyck, Mayeenul Islam, Howdy_McGee Mar 30 '15 at 13:41

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

0

You don't have to register_settigs, you can just add the options straight to the database with add_option().

You could have like a dummy option "all_pages_created" and if that's set then don't check for the individual pages.

if (get_option('all_pages_created') !== false) {
// it's set, do nothing }
else { // check for your pages and update individual_pages_option with update_option()
       // and when all pages are created add_option('all_pages_created', 'true', '', 'yes' )
}

Or something like that. It shouldn't be too hard...

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