Title: Save widget options as array
Last modified: August 20, 2016

---

# Save widget options as array

 *  Resolved [shazdeh](https://wordpress.org/support/users/shazdeh/)
 * (@shazdeh)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/save-widget-options-as-array/)
 * I’m using WP_Widget class and I have something like this in my `form` function:
 *     ```
       <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?

Viewing 1 replies (of 1 total)

 *  Thread Starter [shazdeh](https://wordpress.org/support/users/shazdeh/)
 * (@shazdeh)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/save-widget-options-as-array/#post-2243293)
 * Solved. Don’t use the stripslashes function for these fields in `update` function.

Viewing 1 replies (of 1 total)

The topic ‘Save widget options as array’ is closed to new replies.

## Tags

 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 1 participant
 * Last reply from: [shazdeh](https://wordpress.org/support/users/shazdeh/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/save-widget-options-as-array/#post-2243293)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
