Images Aren’t Showing in WordPress Media Library

In this article, I will talk about a quite specific media files issue, which may happen when you deactivate the Multisite Shared Media Library plugin.

To get a clear understanding of the issue, please take a look at the screenshot below:

Images now showing in WordPress media library
Only one image is displayed correctly. Why are all the other images missing?

After deactivating the plugin, you might experience something like this on sub-sites that weren’t used as a network media library. However, if you changed the network library main site multiple times, then most likely, you will experience missing images on all sub-sites of your network.

The missing images here are not actually images – these are small pieces of information in the database – placeholders, which allow the network library to work flawlessly.

As you can see, placeholders aren’t automatically removed when you deactivate the plugin. However, if you delete the plugin from your network, the placeholders will be cleaned up.

You can also use an SQL query to remove placeholders from a specific site manually:

DELETE attachments 
	FROM wp_2_posts as attachments
INNER JOIN wp_2_postmeta AS meta1
	ON meta1.post_id = attachments.ID
INNER JOIN wp_2_postmeta AS meta2
	ON meta2.post_id = attachments.ID
WHERE attachments.post_type = 'attachment'
	AND meta1.meta_key = '_sml_library_id'
	AND meta2.meta_key = '_sml_attachment_id'

You can use this SQL query in phpMyAdmin, for example, but I recommend doing a database backup first. Don’t forget to replace wp_2_ with the actual prefix of the target sub-site.

Need more help?