Forums
Forums / Plugins / Hacks / Save widget options as array
(@shazdeh)
14 years, 10 months ago
I’m using WP_Widget class and I have something like this in my form function:
form
<p> <label><?php _e('Test:') ?></label> <input type="text" name="<?php echo $this->get_field_name('test') ?>[]" class="widefat" /> <input type="text" name="<?php echo $this->get_field_name('test') ?>[]" class="widefat" /> </p>
Now, shouldn’t WP save the ‘test’ field as an array? When you use Options API it does, why this doesn’t work on widgets?
Solved. Don’t use the stripslashes function for these fields in update function.
update
The topic ‘Save widget options as array’ is closed to new replies.