WordPress.org

Support

Support » Plugins and Hacks » Media items manual sorting not working in admin

Media items manual sorting not working in admin

  • Saving/updating the folder post details in admin, the media attachment manual ordering isn’t updated.

    // Quick fix in class-eazyest-folderbase.php, save_attachments() function
    
    $reordered = isset( $_POST['gallery-changed-media'] ) && $_POST['gallery-changed-media'];
    
    // add an if section before foreach( $_POST['attachment']
    // $_POST['attachment'] missing ..
    // get the media list form  $_POST['gallery-order-media']
    //
    if ( $reordered && ! isset($_POST['attachment']) ) {
    
    	$_POST['attachment'] = explode(' ', $_POST['gallery-order-media']);
    
    	foreach( $_POST['attachment'] as $item_id ) {
    
    		$attachment = get_post( $item_id );
    		$attachment->menu_order = array_search( $attachment->ID, explode( ' ', $_POST['gallery-order-media'] ) );
    
    		wp_update_post( $attachment );
    	}
    
    }

    Using

    http://wordpress.org/extend/plugins/eazyest-gallery/

  • The topic ‘Media items manual sorting not working in admin’ is closed to new replies.