Help to create the best plugin settings!
Help to create the best plugin settings!
Help to create the best plugin settings!
All the out-of-the-box API endpoints are documented quite well here: https://developer.wordpress.org/rest-api/reference/ A quick look in the relevant places didn’t turn up a way to get theme elements (although I might have missed it). It’s trivially easy to setup new API endpoints; here’s a quick example you could pop into your funcitons.php to ‘hard-wire’ into that … Read more
Here is the function I used to solve the problem function username_editor_roles_callback() { global $wp_roles; $roles = $wp_roles->roles; foreach ($roles as $role) { $roleName = $role[‘name’]; $output = sprintf(‘<input type=”checkbox” id=”ue_roles_checkbox” name=”username_editor_settings[ue_roles_confirm][]” value=”%1$s” %2$s><label for=”ue_roles_checkbox”>%1$s</label><br>’, $roleName, checked( in_array($roleName, (array) ue_settings_option()[“ue_roles_confirm”]), 1, false ) ); echo $output; } }
Is it possible to have a global parameter page which allows to configure other plugins in the same place?
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].'”>’; } }
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
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
WP Optimization: Overwriting options to autoload=yes for often used options?
What is the XSSAttack option_name for in the options table?