• I am trying to store multi select values from a form in a widget but only the last one is getting stored.

    I tried everything I found online with no luck

    here is my code

    PasteBin

    Thanks!
    4nt0n

Viewing 1 replies (of 1 total)
  • It’s probably because you’re using esc_sql() for sanitizing:

    $instance['select'] = esc_sql( $new_instance['select'] );

    You should use something like:

    $instance['select'] = is_array( $new_instance['select'] ) ? array_map( 'absint', $new_instance['select'] ) : array();
Viewing 1 replies (of 1 total)
  • The topic ‘Multi select in widget form’ is closed to new replies.