I'm working on a Wordpress plugin that uses the Wordpress Options.php functionality. I have a settings_field registered and access those options with this:
$xoptions = get_option('xsettings');
So that on my page I can reference $xoptions["first_name"] to pull given settings, and have them saved and updated automatically via Wordpress' Options.php. The problem is, I can't read or set values in the $xoptions associative array manually without having to use the "xsettings[first_name]" syntax that gets buried in the HTML and submitted with a form. I need to update these values without sending a form.
What I'm trying to do, basically, is set the value of one of those values manually like this:
$xoptions['first_name'] = "Derek Walters";
but that doesn't work as it would with a normal associative array. I'm wondering if there's a way to manually read and write names/values from Worpress Options.
I've tried setting it manually with
update_option('first_name',$_POST['name']);
Any help would be fantastic. Thanks in advance! I've been Googling for hours and trying different slabs of code and haven't figured out if it's even possible.
update_option("xsettings", $xoptions)after$xoptions['first_name'] = "Derek Walters";- imtheman