update_option does not work in this scenario – how do I fix?
I realised this was occurring because in my code, $log was a huge amount of text, therefore it appears there is a limit to what you can store in an option.
I realised this was occurring because in my code, $log was a huge amount of text, therefore it appears there is a limit to what you can store in an option.
Something was wrong with the naming, I had to change the field names, and it works ok. From your code sample, this: add_settings_field( ‘frontend-font’, // id attribute of tag __(‘بارگذاری فونت برای بخش اصلی سایت’, ‘persianfont’), // Title as lable for field function(){ var_dump(get_option( ‘persianfont’ )); //$check_frontend_font = is_null(get_option( ‘persianfont’ )[‘frontend-font’]) ? ‘true’ : get_option( … Read more
That option is special in that WordPress has code to intercept your call for security reasons: https://codex.wordpress.org/Function_Reference/update_option_new_admin_email This function intercepts changes to the administrator’s email address. It keeps the address from being updated and instead sends the user a confirmation email, with a link to confirm the change. What you’re trying to do could be … Read more
There is no field in HTML called font. You need to create select dropdown. Also change it’s name for uniqueness.
You inserting the value of the get_option(‘go_to_top_or_bottom’);as a property in the $this->options so when you actual try to print it like this print_r($this->options[‘turn_on’]);you get the index error because this is a property!!! Correct way will be $this->options[‘turn_on’]=get_option(‘go_to_top_or_bottom’); Update I see that the $options is a private meaning you cannot access it outside of the class. … Read more
Did you confirm it was the transient values causing the options to not update? Here’s the WordPress function to clear transient values: https://codex.wordpress.org/Function_Reference/delete_transient An example: <?php // Create a simple function to delete our transient function edit_term_delete_transient() { delete_transient( ‘the_transient_name_to_delete’ ); } // Add the function to the edit_term hook so it runs when categories/tags … Read more
echo ‘<form action=”” class=”booked-settings-form” method=”post”>’; $default_content=”<p>Mail formate</p>”; $editor_id = ‘customerCleanerMail’; $option_name=”customerCleanerMail”; $default_content=html_entity_decode($default_content); $default_content=stripslashes($default_content); wp_editor( $default_content, $editor_id,array(‘textarea_name’ => $option_name,’media_buttons’ => false,’editor_height’ => 350,’teeny’ => true) ); submit_button(‘Save’, ‘primary’); echo ‘</form>’; if(isset($_POST[‘customerCleanerMail’]) ){ $var2=htmlentities(wpautop($_POST[‘customerCleanerMail’])); $fff=update_option(‘customerCleanerMail’, $var2); } In form section i used wp_editor with his options, wp_editor work like html editor but when you store these data … Read more
You have to add filter: add_filter( ‘cron_schedules’, ‘minute_interval’ ); Otherwise your function minute_interval is not invoked, interval is not defined, and event doesn’t work.
You need the settings_errors(); function somewhere on your settings page: function display_acme_options_page() { settings_errors(); echo ‘<h2>Acme Options</h2>’; echo ‘<form method=”post” action=”options.php”>’; do_settings_sections( ‘acme-options-page’ ); settings_fields( ‘acme-settings’ ); submit_button(); echo ‘</form>’; }
It sounds like you need custom meta boxes. You could either create your own plugin to add them or use a plugin like Advanced Custom Fields. You would add two meta boxes to each post type where you want to be able to select these options, one to select the image, and another to set … Read more