How to use checked() function with multiple check box group? How to properly sanitize that checkbox group?

So checked is fairly simple to understand. It compares the first two values. If they’re equal, it spits out checked=”checked” if they aren’t equal nothing happens. <?php $saved = ‘on’; $compare=”on” // spits out checked=”checked” checked($saved, $compare); $saved = ‘off’; // does nothing checked($saved, $compare); How you save check boxes it up to you. Because … Read more

Update plugin settings option_name for big plugin update

I think changing array keys is more of a PHP problem // Get entire array $plugin_options = get_option( ‘plugin_options’ ); $new_options = array(); if( isset( $plugin_options[‘ga_accountId’] ) ) $new_options[‘ga_account_id’] = $plugin_options[‘ga_accountId’]; // Update entire array update_option( ‘plugin_settings_general’, $new_options ); // Delte old array delete_option( ‘plugin_options’ ); Any end-user who might be using using your plugin’s … Read more

add_settings_field (exclude categories->reading) wp_category_checklist

FWIW, to get this to work as intended, I went ahead with the wp_dropdown_categories function approach, settling for a js on-load hack to facilitate selection of currently excluded categories witin the dropdown. /* Add Settings Field –“Exclude Categories”– under options-reading.php page */ class Add_Settings_Field { public function __construct() { add_filter( ‘admin_init’ , array( &$this , … Read more

Can Settings API setting generate other settings?

I believe you should be able to use the update_option_{$option} hook: do_action( “update_option_{$option}”, $oldvalue, $_newvalue ); Something like: add_action( “update_option_youroptionname”, function ($oldvalue, $_newvalue) { // process your option value and update/insert options as needed // var_dump($oldvalue, $_newvalue); // debug // wp_die(); // debug }, 1,2 ); Be sure to replace “youroptionname” with the appropriate value.

How do I display a WP Option from an array?

I found a solution!!! <li class=”tweat”> <a href=”https://wordpress.stackexchange.com/questions/124927/<?php $globalOptions = get_option(“global_options_arraykey’); echo $globalOptions[‘twitterid’];?>”>Visit our twitter Account</a> </li> I got it from this site: Get Option for an Element in an array – WordPress-Hackers

How to handle complex data with Settings API

When you call register_setting, the third parameter is the sanitize callback function. You can do whatever data manipulation you need in that function, in order to arrange the user input into the format you need for your code. So after the data validation (integers are integers, sanitize text fields, etc.), you can retrieve the current … Read more

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