WordPress – a CMS being used by millions of websites which accounts for more than 35% of the total websites on internet – is always updating and bringing in new features to make it more user friendly. WordPress 5.9 was recently released as a major update on 25th January, 2022 which brought it a host of new features such as Full Site Editing, Global Styles, Blocks, Patterns, APIs, UI Enhancements, and Much More.
Though along with new updates, there are usually a few bugs that slip out of the contributors’ eyes and one such bug has been noticed by few users and it has been logged and brought to notice of the developers by a user. This bug is related to WordPress media gallery where user’s can’t drag and drop to rearrange media files in WordPress gallery.
Check out the thread on WordPress Core tracking: Media Library Overlay Drag-and-Drop To Reorder Images Does Not Work In WP 5.9
The issue:
If you have updated to WordPress 5.9, you will notice that if you are adding a media gallery in your post/page and if you want to rearrange the media items, you can drag the media items, but dropping them at your desired place to rearrange the items won’t work. (shown in the snapshot below)
How to fix?
To fix this, there are 3 options.
- Wait for the update from WordPress (version 5.9.1 will have a fix for this issue)
- Add code in functions.php to include jQuery UI 1.13.1 (fix suggested by our reader MARIO MESITI in the comments)
- Downgrade to WordPress 5.8.3
Steps to add code in functions.php to include jQuery UI 1.13.1
Warning: These steps are not recommended for beginner WordPress users.
- Open your active theme’s functions.php file in code editor using an FTP or go to Appearance > Theme Editor > functions.php (recommended to use FTP instead)
- Copy following code(skip 1st line – which is the Php opening tag) to end of the file, save the file and clear cache.
Steps to downgrade to WordPress version 5.8.3
- Log into your WordPress site dashboard.
- Navigate to Plugins > Add New.
- Search for WP Downgrade | Specific Core Version plugin. Install and activate this plugin.
- Navigate to Settings > WP Downgrade.
- Put 5.8.3 in WordPress Target Version field and click Save Changes.
- Click on Up-/Downgrade Core button. This will take you to WordPress Updates page.
- Click on Re-install version 5.8.3 button.
- Done! Now you are on WordPress 5.8.3. You can now rearrange your gallery as you please!
Let us know if you are having any difficulties in following the steps given above or if you faced any other bugs in WordPress 5.9!
4 thoughts on “Gallery drag and drop not working in WordPress 5.9 [fix]”
hi
i tried this but all my css unlinked itself.
Hi Damian,
Did you re-upgrade your site after that?
I solved the problem adding this action:
function fix_jquery_sortable()
{
$strVersion=get_bloginfo(‘version’);
if ($strVersion==’5.9′) wp_enqueue_script(‘fix-jquery-ui’,’https://code.jquery.com/ui/1.13.1/jquery-ui.js’ );
}
add_action(‘admin_enqueue_scripts’, ‘fix_jquery_sortable’, 99);
if WP version is 5.9 the whole jquery ui is loaded from standard cdn (I couldnt find a suitable stand alone file for jquery ui sortable).
Hi Mario,
Thank you for your comment! I have updated the article to include your solution(with slight modification) as well. 🙂
It will surely help some users!
Comments are closed.