Reorder attachements in the media library

Attachments in Media Library are obtained using WP_Query, so you can modify that query with pre_get_posts action.

By default they are sorted DESC by post_date.

So the easiest way to fix your code would be to change so the new modified attachment has the same post_date set as the original one.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)