wp-shortcake / shortcake

Shortcake makes using WordPress shortcodes a piece of cake.
GNU General Public License v2.0
665 stars 143 forks source link

Select fields "selected" attr not being set #761

Closed pressoholics closed 6 years ago

pressoholics commented 6 years ago

Looks like there is an error in the edit-form.tpl.php underscore template.

On line 61 the 'selected' attr is never set to an option as a single value is being passed to the _.filter function instead of an array so the selected attr is never set to the option tag:

When i convert the data.value into an array [data.value] it all works fine.

Change this:

! _.isEmpty( _.filter( data.value, function(val) { return val === option.value; } ) ) ) { print('selected'); }

To this:

! _.isEmpty( _.filter( [data.value], function(val) { return val === option.value; } ) ) ) { print('selected'); }

I think this has only been an issue since version 0.7.2

Awesome plugin BTW!

goldenapples commented 6 years ago

This bug was fixed in #745, but apparently that - and several other completed bugfixes - haven't made it into the .org repository. I'll cut a new release, so that these bugs aren't floating around in the public release.