Save Plugin Options as Array

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].'”>’; } }

How to load WordPress on non WP page?

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

Call require_once form admin page with checkbox

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’; }

Option value not get saved in the database

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)