I am busy dabbling with writing a WP plugin and hitting a bit of a problem.

I believe its best practice to store wp options to an array rather than individually which is great no probs.

I have two pages. Page one which updates for example:

$xyz_options['api_user']; 
$xyz_options['api_key'];

Page two which say has:

$xyz_options['site_bgcolor'];
$xyz_options['site_fontcolor'];

However when updating from either of the pages it empties the other pages settings when using the built in wordpress form building and so forth. I am wondering if I would be better breaking away from the built in methods would be best or is there another way using WP methods that I have missed.

A quick example. Say I first set api_user and api_key with 1 and abc123. Then go to style page and update site_bgcolor with #fff and site_fontcolor with #000 it updates the colors but the api_user and api_key values vanish from the $xyz_options array pulled from wp_options.

Hope that makes sense.

Thanks guys in advance any pointers would be great.

没有正确的解决方案

许可以下: CC-BY-SA归因
scroll top