Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [update-option]

Updates a named option/value pair to the options database table.

0
votes
1answer
43 views

update_option_$option action not working as expected

I have a custom admin page that uses the settings API. Form submits to options.php. After submission I am attempting to do something in the background. I am hooking into update_option_$option to do ...
0
votes
0answers
25 views

update_option returns false in AJAX, how to debug?

I tried debug plugins for WordPress, but they only show the current page SQL queries. How to debug if update_option returns false? I am updating an object decoded from AJAX request with json_decode ...
1
vote
1answer
59 views

How to save widget fields generated from an array?

I created simple php abstract widget class that can generate form with fields from an array. When I try to save fields, all changes are removed. Abstract Widget Class: <?php /** * Abstract ...
0
votes
1answer
25 views

Is there a limit to size of data stored in update_option()?

I've checked out several* questions and WP docs and I have some idea of the answer but am looking for a specific number on the following questions: 1- Is there a limit to the size of data (kb,mb, ect)...
0
votes
1answer
41 views

How to use update_option() without replacing/losing the old value?

I want to update an option, but instead of replacing the old value with the new one, Ì want to add new value to existing one. So the new value should be $oldvalue + $newvalue. I read about ...
0
votes
1answer
130 views

save multi-select input using update_option for plugin

Trying to save some plugin data to the wpdb using the update_option method. This code works fine for my single value ad_url, but fails for my array exclude_posts. The POST data in Chrome dev panel ...
0
votes
1answer
23 views

How to save the option's new values plus old value without overwrite old one

i have just tried this function myplugin_update_field_foo( $new_value, $old_value ) { if ($newvalue !== $oldvalue && !empty($oldvalue)) { $newvalue = array_unique( array_merge( $newvalue, ...
1
vote
1answer
166 views

possible to make sections in theme customizer sortable and saveable at publish button clicked?

We do have kirki(a theme customizer toolkit) sortable field. But i want to apply the same logic on the sections itself instead of creating another section with sortable fields. I'm using options ...
0
votes
1answer
24 views

How to update option field in database on clicking the publish button in customizer

I want to use update_option('option_name', $new_array) to change the database option value when user clicks the publish button in wordpress theme customizer. How to do it?
0
votes
1answer
36 views

WP options plugin setting not saving the selected checkboxes

I am trying to make a plugin, so far everything is working, the problem is when its time to "save changes" the text are saved but the selected 2 checkbox didnt save so both remains unchecked. Heres ...
0
votes
2answers
218 views

Plugin setting page - update_option problem

I am new to plugin develop and I have a problem with settings page of my new plugin. My page seems to save correctly settings data to wordpress database, but after a few hours/days value stored on ...
1
vote
1answer
121 views

Adding Default Settings to Theme My Login plugin

I am trying to update a plugin called Theme My Login with default settings. The problem is that the updates are only applied to the database. When I log into WordPress I can't see the options updated. ...
0
votes
2answers
782 views

how to save wp_editor html content in options table

wp_editor( $default_content, $editor_id,array('textarea_name' => $option_name,'media_buttons' => false,'editor_height' => 350,'teeny' => true) ); submit_button('Save', 'primary'); ...
1
vote
1answer
336 views

Update Option Error: Notice: Undefined index

I have created a WordPress plugin and added an options page. There is an error message when the check box unchecked: Notice: Undefined index: upo_enable But when the check box checked it works ...
0
votes
0answers
27 views

Editing a loaded Wordpress option without updating the database

Is it possible to edit an option such as the page_on_front setting in a local scope, without updating the option in the database? For instance, I am attempting to serve a different homepage to logged ...
0
votes
2answers
68 views

Update WP option by plugin

I wanted to set value of WP option (more specifically - 'admin_email') by using plugin, its option (plugin option) and update_option(). I tried using lines like below, but when plugin code contains ...
0
votes
2answers
569 views

add_settings_error on validating plugin options API

I am developing a plugin which uses options API. I defined a class that uses a function to sanitize the inputs, but when I submit the options form, It displays errors and info twice. And also I didn'...
0
votes
1answer
737 views

How to save plugin custom settings page fields

I want to implement a plugin which gets 2 fields in admin area and saves those in options as array I read the page Custom Settings Page but seems it doesn't describe how to save fields values in ...
0
votes
1answer
132 views

update_option does not work in this scenario - how do I fix?

I am attempting to use update_option to add or update an option. I have created a test below which creates a settings page and when loaded it runs my awd_do_sync function, but the option does not get ...
0
votes
1answer
380 views

Which action hook to update custom field at network/site-info.php in multisite on update site info

I am currently using code to add a custom field to the site-info.php & site-new.php in the network admin management to add a custom option to the database, this does work when I create a new ...
1
vote
0answers
54 views

What is the correct way of updating wordpress options

I've added some codes to my theme's function so when I activated the theme, it will update the category base, permalinks, and post_per_page, and they worked perfectly fine. However, since I'm just ...
0
votes
0answers
113 views

How to get a post meta value and pass that to update_option when a post is created or updated?

When a user publishes or updates a post I want to get a post meta value from that post itself. Then I want to use update_option() to pass that value into the get_option() name. I've been trying ...
1
vote
0answers
31 views

Setting default category base on theme activation

I'm trying to set a custom category base upon theme activation which also don't allow user to change it. If user tries to change it, it'll just gets back to "genre". Here's my code so far: if (...
1
vote
1answer
770 views

update_option is not working!

I am writing a plugin and I need to use the update_option function to update an array I have stored as an option in WP. For the admin panel I used the settings API but for this portion I need to use ...
0
votes
0answers
540 views

Why is the Wordpress update_option not working in this code?

I am writing a Wordpress plugin that uses an array as an option but the new value is never set when I run update_option function. The first time this runs last_updated is a new element in the array ...
0
votes
0answers
328 views

Wordpress update plugin through Dashboard/Plugins displaying error

The update fails if I try the update through Dashboard/Plugins, but the update works if I update it thru Dashboard/Updates. It displaying error when I try to update from Dashboard/Plugins path. That ...
0
votes
1answer
33 views

How to reinstate previously saved option?

I am working on a simple plugin (kind of maintenance plugin) where I am updating the homepage based on user page option choice. function set_hp(){ $page = get_option('get_the_page'); if ( $page ) {...
0
votes
1answer
290 views

$wpdb->update does not update, var_dump of data is correct

I have a problem with the $wpdb->update below. The var_dump data is correct but the update is not saving the data into the record of the table. Table name is wp_rdp_media_organisations. Unique field ...
1
vote
1answer
136 views

Store and Work with huge array in WP [closed]

I need to get all terms that have post with dates in custom field. So I need a list for all dates from the term. I need to know exactly what is tha dates within each term in my site. It's not in term, ...
1
vote
2answers
951 views

Update problem with update_option() in combination with register_setting()

Intro I have a settings page which includes a setting with a more complicated callback function to save. Save data To save the data I use the register_setting() function with a custom sanitize ...
1
vote
1answer
528 views

Modifying protexted image sizes: use “add_image_size()” or “update_option()”?

I'm finding conflicting info on whether it's okay to override protected WordPress image sizes (thumbnail, medium, medium_large, and large) with add_image_size(). Some docs indicate it's better to do ...
0
votes
1answer
163 views

How (or where) do I get wordpress plugin update download link?

When I update a plugin, that isn't hosted on the repository, I often wonder "Where is the updated plugin being downloaded from?". Any idear on how would I go about find out the update link?
6
votes
1answer
247 views

WordPress updates defined vs add_filter?

I'm trying to create a WordPress update automation plugin. here I got two option to make enable and disable the updates. Via define ex :defined( 'AUTOMATIC_UPDATER_DISABLED',true ) 2.via ...
1
vote
1answer
866 views

Wordpress get_option and update_option returned entered on the textbox field

I do have a problem regarding the plug-in settings that I've made. I've created a simple textbox and a submit button and run it on the admin page setting. The name of the textbox and submit button is ...
1
vote
0answers
136 views

wp cron job fires at every second or so, if callback is wrapped with DOING_CRON check it never fires at all

I am a bit lost while dealing with a open source plugin implementing wp cron. You can read about the problem on github https://github.com/nekojira/wp-currencies/issues/6#issuecomment-116735909 - I ...
0
votes
1answer
280 views

update_option_{$option} not showing old value

I have the following bit of code (note, I put the mail() function in only to see what the values are): add_action('init','system_init_actions'); function system_init_actions() { add_action('...
0
votes
1answer
2k views

update_option in WordPress AJAX

I have this example: For example, this code will register a callback called "wpa_49691": add_action( 'wp_ajax_wpa_49691', 'wpa_49691_callback' ); add_action( 'wp_ajax_nopriv_wpa_49691', '...
0
votes
0answers
28 views

How to display the link that says “Edit Header Image” on header image

I have a website which featured with WP custom header image without plugin. I would like to ask that, is it possible to display a text with link which allows website owner easily change the header ...
0
votes
1answer
159 views

Can't switch theme after activation

I'm creating a plugin (I'm very newbie in this) to load custom taxonomies, custom post types and an automatic activation of a theme, so I have this code: // Custom Post Types and Taxonomies ...
0
votes
1answer
637 views

Cannot Update wp DB - Get 500 Error

I have this site on godaddy Failpeep.com , It started giving me this problem yesterday , When I tried to login to admin area , It 1st kept loading if I entered the correct password and took me to a ...
3
votes
1answer
1k views

How to update widget from widget() function?

I'm trying to create a simple linkroll widget for displaying recent https://pinboard.in links via their API. To maximize loading speed, I want to cache the linklist in a widget field, as well as the ...
0
votes
1answer
69 views

Updating options into the wp database performance

I have a question about the performance of my plugin. On the settings page of my plugin I have about 20 options the user can change (checkboxes, dropdown and normal text inputs). Currently I just ...
0
votes
1answer
110 views

Changing plugin options from theme functions file?

I am making a starting-point Wordpress theme that will be used on dev projects. In this theme, I am automating common plugin installs that are used on every project. I have been able to automate ...
3
votes
1answer
2k views

Using update_option() and get_option() is echoing escaped strings

I'm using the Option API for my theme settings page. I use the $_POST data to update the options when the changes are saved. My issue is that the strings I send get escaped and when I use this code: ...
0
votes
1answer
183 views

Theme settings Page: Settings Api vs Update_Options

I’m a new WordPress developer trying to start a carrier selling Premium Themes. In the last week, I’ve been confronted to many difficulties trying to understand how to create a theme options page. At ...
0
votes
0answers
56 views

Edit a custom admin page

I have created a custom admin menu page with: add_menu_page This page uploads a form to the wp_options table in the database. Basic save with update_option like: function addressbook_save (){ if(...
1
vote
1answer
2k views

delete_option() and update_option() returning false

I know that when delete_option() or update_option() fail to perform their respective database interactions, they return false. Does anyone know why they wouldn't be able to perform these actions? It'...
1
vote
0answers
229 views

Is there an atomic way to update_option in Wordpress (to ensure data integrity)?

I want to update an option which is an array by adding a new value, but there's no atomicity or guarantee of data integrity. EXAMPLE //Get the option value (an array) $val = get_option( "some-option"...
1
vote
0answers
198 views

Excessive memory used by update_option()

I'm a newer WP developer trying to wrap his head around how to store information in the options table to support a plugin that I am writing. Unfortunately, trying to UPDATE the options table is making ...
2
votes
1answer
1k views

How do I setup nested repeatable option fields?

I'm trying to wrap my head around how to create a set of option fields that should be able to repeat for as many times as possible. But I'm having a hard time to figure out how to proceed. Currently ...