Option does not save or update upon page refresh

Maybe a little debugging will help. Try this in your piece no.1 $theme = AisisCore_Factory_Pattern::create(‘AisisCore_Template_Builder’); if(isset($_POST[‘aisis_reset’])){ $theme->reset_theme_options(); } $options = get_option(‘aisis_reset’); print_r( $options ); //outputs $options value wp_die(); //will halt further process if($options == ‘true’){ echo ‘<div class=”alert alert-success”><strong>SUCCESS!!!!</strong> All Options have been reset! You can start again!</div>’; update_option(‘aisis_reset’, ‘false’); } What value do you … Read more

Incorporating the Settings API in WordPress Themes – by Chip Bennet

You should include your options-register-defaults.php to make the callback available. function chr_settings() { require_once ‘options-register-defaults.php’; // add path to file /* register_setting( $option_group, $option_name, $sanitize_callback )- Associates an option group passed to settings_fields with database entry */ register_setting( ‘mycustom_options’, ‘mycustom_options’, ‘ch_options_validate’ ); add_settings_section(‘ch_settings_defaults_style’, ‘Style Options’, ‘ch_settings_defaults_style_section_text’, ‘mycustom’); }

how can i add_option as array from a form with just a text input

Something like this should work. function si_ad_call_models() { if ( isset( $_POST[‘submit’] ) ) { // Checking that $_POST[‘new_model_name’] is set is probably not enough validation. if ( isset( $_POST[‘new_model_name’] ) ) { // Get the stored models. if ( get_option( ‘si_ad_call_model’ ) ) $si_ad_call_models = unserialize( get_option( ‘si_ad_call_model’ ) ); else $si_ad_call_models = array(); … Read more

Adding data to options table

This is an expansion of my comment on OP: function is_forum_subscribed($user_ID) { if($user_ID) { $useremail = $this->get_userdata($user_ID, ‘user_email’); $list = get_option(“mf_forum_subscribers_”.$this->current_forum, array()); if(in_array($useremail, $list)) return true; } return false; } } You can call this function like this, instead: is_forum_subscribed($player->ID);

How do I create settings only used by my theme? [closed]

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 … Read more