Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Widget saving value correctly, but not updating new value. WordPress


I have a widget that I'm saving just a few values to. It was working fine, but I've knocked something off track.

It saves the values of the post and comment count correctly, but doesn't update the value in the form field. So even if I set the comment count to 4, it reverts back to 1 ( But the values work on the front end, so something it's half working.

Here is the full code to the widget:

Any help is appreciated, thanks!


Answers (1)


Kailey Lampert answers:

I think this line is doing something unintended.
$instance = $instance['user_id'];

You're redefining $instance, but then call values from it in the next 2 fields.

Kailey Lampert comments:

Changing $instance = $instance['user_id'];
$option_list = user_get_users_list_option($instance);

$user_id = $instance['user_id'];
$option_list = user_get_users_list_option($user_id);
should fix the problem.

Mike McAlister comments:

I was hoping you'd still be hanging around these parts! :) Worked perfectly. Thanks, Kailey!