Skip to content

Instantly share code, notes, and snippets.

@sbruner
Last active March 1, 2017 22:19
Show Gist options
  • Save sbruner/b54b838632e382c663aef358a58db37e to your computer and use it in GitHub Desktop.
Save sbruner/b54b838632e382c663aef358a58db37e to your computer and use it in GitHub Desktop.
<?php
//When the user enters data in the piklist_demo_fields settings page and they press save, add another setting called option_key with the value of option_value.
add_filter('piklist_pre_update_option','my_update_option',10,4);
function my_update_option($settings, $new, $old) {
if ($setting == 'piklist_demo_fields') {
$settings['option_key'] = 'option_value';
}
return $settings;
}
@hughc
Copy link

hughc commented Mar 1, 2017

I'm a bit confused about this one... unless $setting is global, I can't see where it comes from. Missing from the function signature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment