WP Manifestindependent plugin directory
manifest / media / fix-mime-types

Fix Media MIME Types (CLI only)

WordPress plugin: fixes incorrect MIME types in the Media Library using WP-CLI.

★ 2stars
15release downloads
1.0.0latest · 1 year ago

Install

Download fix-mime-types-1.0.0.zip From the 1.0.0 release on GitHub, Jan 8, 2025

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/javiercasares/fix-mime-types/releases/download/1.0.0/fix-mime-types-1.0.0.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Fixes incorrect MIME types in the Media Library using WP-CLI.

Description

Fix Media MIME Types (CLI only) is a lightweight and efficient plugin that identifies and corrects any incorrect MIME types in your WordPress Media Library.

Key Features:

  • Scans your entire Media Library for potential MIME discrepancies.
  • Uses PHP's FileInfo to detect the correct MIME type of media files.
  • Updates the WordPress database only when a mismatch is found, ensuring minimal overhead.
  • Designed solely for command-line usage (WP-CLI), with no impact on normal site visitors or admins.

This plugin is not visible in the standard WordPress interface (it is WP-CLI only). To use it, you must have WP-CLI installed on your server or local environment.

WP-CLI

You can use the following WP-CLI commands:

  • wp fix-mime run

That will show something like:

Found 3 attachments. Starting the process...
Warning: Attachment ID 1: file does not exist on disk. Skipping...
Attachment ID 2, File: example1.webp, Current MIME: image/webp, Detected MIME: image/webp
No changes needed.
Attachment ID 3, File: example2.webp, Current MIME: image/png, Detected MIME: image/webp
No changes needed.
Success: Process complete. All MIME types have been verified/updated.

Installation

Automatic download

Visit the plugin section in your WordPress, search for [fix-mime-types]; download and install the plugin.

Manual download

Extract the contents of the ZIP and upload the contents to the /wp-content/plugins/fix-mime-types/ directory. Once uploaded, it will appear in your plugin list.

Compatibility

  • WordPress: 6.4 - 6.7
  • PHP: 8.2 - 8.4
  • WP-CLI: 2.3.0 - 2.11.0

Changelog

[1.0.0] - 2025-01-08

Added

  • First release.

Compatibility

  • WordPress: 6.4 - 6.7
  • PHP: 8.2 - 8.4
  • WP-CLI: 2.3.0 - 2.11.0

Tests

  • PHP Coding Standards: 3.10.3
  • WordPress Coding Standards: 3.1.0
  • Plugin Check (PCP): 1.1.0

Security

This plugin adheres to the following security measures and review protocols for each version:

Privacy

  • This plugin does not collect any information about your site, your identity, the plugins, themes or content the site has.

Vulnerabilities

  • No vulnerabilities have been published up to version 1.0.0.

Found a security vulnerability? Please report it to us privately at the Fix Media MIME Types GitHub repository.

Contributors

You can contribute to this plugin at the Fix Media MIME Types GitHub repository.

Releases

1 release. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
1.0.0 latest
Jan 8, 2025 1 year ago
fix-mime-types-1.0.0.zip
15