Media Library quirks and bewares

It’s fair to say the Media Library is the weakest area of WordPress, at least for the needs of u3as. Well know is that it’s tricky to identify media items that are not in use so they can be tidied up by deleting them. It’s also annoying that images can’t simply be pasted into a block with a prompt proffered to give it a name and alternate text.

There are other quirks to be aware of:

Media items are referenced by a URL – while media items have file names they are located by a URL in the same way a browser locates a website.

Replacing a media item – if you upload a media item with the same file name as an existing item WordPress will not replace the item, it creates a new additional item. To be specific, then if the item was uploaded in the current month then it will append “-1” (or -2 etc.) to the file name. If the item being replace was upload in a previous month then it goes in a different folder/directory in the WordPress file store but will retain its name, assuming there isn’t an item with the same name there as well.
This is because WordPress creates a new folder/directory for the Media library each month. For example 2024/07/ as in:

siteworks.u3a.org.uk/wp-content/uploads/2024/07/WM-migration-Go-Live-Instructions-and-chklist.pdf

Remove unwanted Media – the simple answer is that unless you are confident the item is not used, don’t.

If WordPress states an item is ‘Unattached’ using the filter on the right it is not at all reliable. Apparently “Unattached” does not mean “Unused”.

One example is if you replace an image using Replace on the block’s menu then the replacement shows as Unattached yet the original remains attached.

There are plugin tools that try harder to list unreferenced items, but because the way WordPress works internally they cannot be completely reliable, even if you are lured into taking up the offer of a paid version.

This external article on webtrainingwheels.com explains more of the technical detail and some WordPress history.

Cataloguing media – on approach that can ameliorate chaos is to adopt file naming conventions. For example, all items specific to groups could start with a “z” followed by the Group name such as “z Archaeology-treasure.jpg”, “zBridge-bidding-guide.pdf”. Adding the date in the filename can help, e.g. “Walk 2024-08-22.pdf”. Of course this only works well if authors follow the conventions.

Organising media – a Plugin that’s popular with u3as is Media Library Assistant. Note that it’s not supported by the SiteWorks team so please seek help from the Forum rather than our Help Desk. The plugin does not change how WordPress stores media so it can easily be installed and uninstalled without side effects.

Perhaps the most useful Media Library Assistant feature is giving items a category such as “Monthly meeting”. A category can have a parent category, so an image for the Book Group could have the category “Book Group” with the parent category “Groups”.