Articles of update option

Store and Work with huge array in WP

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, it’s in their posts. after that I need to know foreach […]

Settings API – how to update multiple options manually?

I’m storing all my options using Settings API: function registerSettings() { register_setting(‘XX_theme_settings’, ‘XX_theme_settings’, ‘setting_validate’ ); add_settings_section(‘theme_options’, ‘Theme Options’, ‘theme_options_generate’, ‘page1’ ); add_settings_field( ‘XX_Option1’, ‘Option 1’, ‘text_input’, ‘page1’, ‘theme_options’, ‘XX_Option1’ ); add_settings_field( ‘XX_Option2’, ‘Option 2’, ‘text_input’, ‘page1’, ‘theme_options’, ‘XX_Option2’ ); }; add_action(‘admin_init’, ‘registerSettings’); Let’s say I want to update all the options manually (not using forms, […]

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 I’ve setup the visual interface for administering the options, but I have no idea how […]

update_option in javascript

So there’s function in wordpress to update a named option/value pair to the options database table: <?php update_option( $option, $new_value ); ?>. And what I’m trying to do implement this function in javascript so when you hit the bottom of the page an option would update. I am using this script to check when you […]

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: <?php echo get_option(‘myOption’); ?> it echoes the escaped string. So for example, say ‘myOption’ = […]

Why isn't get_option array contents displaying?

I’ve been to countless posts looking for the answer to this and have tried nearly every combination. So obviously, I’m missing a step so small that it’s likely unfathomable to the WordPress community. My code writes the options to the database, but fails to display them back. The array is NOT set. Multiple options can […]

How to update widget from widget() function?

I’m trying to create a simple linkroll widget for displaying recent links via their API. To maximize loading speed, I want to cache the linklist in a widget field, as well as the timestamp when it was fetched last. Now, if a defined time is over, I want to reload the link list via […]

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 add_filter ex:add_filter( ‘allow_major_auto_core_updates’, ‘__return_true’, 1 ); my problem is if I have disabled the updates via define and also have enabled it via add_filter which one will […]

Update Option Stored in Multi-Dimensional Array

I have data in the wp_options table currently stored as a multi-dimensional array (profile_element_order): a:12:{s:17:”img_base64_enable”;s:1:”1″;s:25:”moulding_combination_page”;s:0:””;s:24:”moulding_collection_page”;s:0:””;s:25:”idea_gallery_thumb_height”;s:3:”200″;s:24:”idea_gallery_thumb_width”;s:3:”200″;s:23:”collection_thumb_height”;s:3:”200″;s:22:”collection_thumb_width”;s:3:”200″;s:20:”profile_item_columns”;s:1:”4″;s:17:”idea_item_columns”;s:1:”2″;s:24:”collections_item_columns”;s:1:”2″;s:25:”combinations_item_columns”;s:1:”4″;s:21:”profile_element_order”;a:5:{i:0;s:8:”Option 1″;i:1;s:8:”Option 2″;i:2;s:8:”Option 3″;i:3;s:8:”Option 4″;i:4;s:8:”Option 5″;}} What I’m trying to accomplish is update the profile_element_order option (within those options). Here’s how everything looks so far: function psort_save_order() { global $mouldings_options; $list = $mouldings_options[‘profile_element_order’]; $new_order = $_POST[‘list_items’]; $new_list = array(); // update […]

Adding Widget form fields dynamically

I am trying to add form field to a WordPress widget dynamically. So if the user want to add another date to an event they can click a button to get more fields. The question is: How do save newly created input fields to my database? Do i need to write a custom update function? […]