Sorry I was just referring to my own custom widgets.
When I print my array from the Widgets screen, I get this:
Array
(
[0] => 246
[1] => 198
)
When I print my array from a widget inserted into Page Builder, I get this:
Array
(
[] => Array
(
[0] => 246
[1] => 198
)
)
Page Builder is nesting the array when multiple values are selected from my multiple select (but it doesn’t so this if only one value is selected).
<select id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ) . '[]'; ?>" multiple="multiple">
<?php
$args = array( 'posts_per_page' => -1, 'post_type' => 'page' );
$array_post_id = $instance['post_id'];
$myposts = get_posts( $args );
foreach ( $myposts as $post ){
setup_postdata( $post );
echo '<option value="'. $post->ID .'" ', is_array($array_post_id ) && in_array( $post->ID, $array_post_id ) ? ' selected="selected"' : '','>'. $post->post_title . '</option>';
}
?>
Do you see any issues with the above?