Automattic / custom-metadata

A WordPress plugin that provides an easy way to add custom fields to your object types (post, pages, custom post types, users)
https://wordpress.org/plugins/custom-metadata/
192 stars 46 forks source link

Clonable fields reordering on save #125

Open akv2 opened 9 years ago

akv2 commented 9 years ago

The 0.5 release states:

NOTE: currently multiplied fields will display out of order after saving, however this should not affect anything else other than the admin, should be fixed soon

However, each save action actually actually saves these items in the wrong order. When they are echoed out on the front end they continually flip orders with each concurrent save of the page. It seems that reversing the array before writing it to the admin screen fixes this issue to always save it in the same order. In custom_metadata.php, on line 1193 I added the following as a temporary quick fix:

// reverse array
if ( count($value) > 1 ) :
    $value = array_reverse( $value );
endif;