WordPress 3.5 Gallery Menu Order not set?

it seems to me, after going through the source codes (both PHP and JS), that gallery and it’s order is not saved to database at all. Gallery exists only in JS when you are creating that and even does not persist when you leave a post editing page.

Gallery gets saved only by inserting gallery shortcode with exact order of IDs declared in that shortcode – no extra info is saved to database, it is all about that shortcode.

If you want to loop attachements of a post by menu order, you have to assign to attachment post_type new support for page-attributes from plugin or your functions.php by inserting this code:

add_action('init', 'my_custom_init');

function my_custom_init() {
    add_post_type_support( 'attachment', 'page-attributes' );
}

But, frankly, to assign menu order by enterin’ each attachement edit page is quite pain. If you need to list post’s attachement by menu order, WP 3.5’s default Gallery is not for you and I suggest you to use some proven plugin (eg. NextGen Gallery) or write down a custom plugin which will enable you to either set menu order from Media Uploader or Library.

Leave a Comment