update_option() passing empty array() but still updating
update_option() passing empty array() but still updating
update_option() passing empty array() but still updating
You can update the default front page via WordPress CMS. On the main dashboard, navigate to the ‘Settings’, then ‘Reading’ menu. Change ‘Front Page Displays to ‘A Static Page (select below). Then select the page using the drop down which you require to be your front page.
Creating an array from form inputs before it is posted to the options database
Whats the best practise on how to store json data from a custom settings page?
Retrieve my custom settings in the settings/ API endpoint
Okey I got it. I was close the whole time 🙂 function weborder_leveranstext_render( ) { $options = get_option( ‘weborder_settings’ ); global $wp_roles; $all_roles = $wp_roles->get_names(); foreach ($all_roles as $role => $value) { echo ‘<br><span style=”width: 180px; display: inline-block;”>’ . $value . ‘</span>’; echo ‘<input type=”text” style=”width: 300px;” name=”weborder_settings[weborder_leveranstext][‘.$role.’]” value=”‘.$options[‘weborder_leveranstext’][$role].'”>’; } }
Problem with MEMCACHE and Redis with wp_options
The shortest way is to load wp-load.php and abort the loading of the template engine (Note: You couldn’t do that, if you’d be loading the header file, like you see it on many sites in the interweb). # No need for the template engine define( ‘WP_USE_THEMES’, false ); # Load WordPress Core // Assuming we’re … Read more
I achieved my goal by doing an option check like so, which conditionally loads the various functions in module_2.php, in my main plugin file: // If the checkbox is checked, load module_2.php. if ( get_option( ‘my_checkbox_option’ ) ) { require_once MY_MODULES_PATH . ‘module_2.php’; }
The option value is not being saved in the database because, as you could see below, the registered option name is num_of_columns and not num_of_cols: // The second parameter is the option name. register_setting( ‘purchase-history-grid’, ‘num_of_columns’ ); So make sure that you use the correct option name in your settings field callback: Use get_option( ‘num_of_columns’ … Read more