WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Save widget options as array (2 posts)

  1. shazdeh
    Member
    Posted 2 years ago #

    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?

  2. shazdeh
    Member
    Posted 2 years ago #

    Solved. Don't use the stripslashes function for these fields in update function.

Topic Closed

This topic has been closed to new replies.

About this Topic