Gallery drag and drop not working in WordPress 5.9 [fix]

With the latest WordPress 5.9, users are facing issues in drag and drop rearrangement of media in gallery. Keep reading to know how to fix this issue.

Share Post:

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.

  1. Wait for the update from WordPress (version 5.9.1 will have a fix for this issue)
  2. Add code in functions.php to include jQuery UI 1.13.1 (fix suggested by our reader MARIO MESITI in the comments)
  3. 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.

  1. 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)
  2. 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

  1. Log into your WordPress site dashboard.
  2. Navigate to Plugins > Add New.
  3. Search for WP Downgrade | Specific Core Version plugin. Install and activate this plugin.
  4. Navigate to Settings > WP Downgrade.
  5. Put 5.8.3 in WordPress Target Version field and click Save Changes.
  6. Click on Up-/Downgrade Core button. This will take you to WordPress Updates page.
  7. Click on Re-install version 5.8.3 button.
  8. 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]”

  1. 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).

Comments are closed.

Stay Connected

More Updates