By default, WordPress restricts the upload of certain file types, including .ico files, for security reasons. If you’re unable to upload an .ico file to your site, you can enable support for it using one of the methods outlined below.
Using a Plugin:
- Install and activate a plugin designed to enable support for additional file types. A common example is “Enable SVG, WebP, and ICO Upload” or similar plugins.
- After activation, navigate to the plugin’s settings to ensure ICO file uploads are enabled.
Modifying wp-config.php:
- Access your site’s files via FTP or your hosting provider’s CPanel.
- Locate the
wp-config.phpfile in the root directory of your WordPress installation. - Open the file for editing and add the following line of code before the line that says
/* That's all, stop editing!Happy publishing.*/:
define( 'ALLOW_UNFILTERED_UPLOADS', true );
Adding ICO Support in functions.php (using Code Snippets):
- To enable ICO file uploads in WordPress using a code snippets plugin like “Code Snippets” or “WPCode,”.
- Install and Activate the Code Snippets Plugin:
- Navigate to Plugins > Add New in your WordPress dashboard.
- Search for “Code Snippets” or “WPCode” and install and activate the desired plugin.
- Add a New Snippet:
- Go to Snippets > Add New (or the equivalent menu item for your chosen plugin).
- Give your new snippet a descriptive title, such as “Allow ICO File Uploads.”
- Insert the Code:
- Copy and paste the following PHP code into the snippet content area:
- Save and Activate the Snippet:
- Save the snippet.
- Ensure the snippet is activated. Most code snippet plugins have a toggle or checkbox for activation.
- Install and Activate the Code Snippets Plugin:
function my_custom_mime_types( $mimes ) {
$mimes['ico'] = 'image/vnd.microsoft.icon';
return $mimes;
}
add_filter( 'upload_mimes', 'my_custom_mime_types' );
After completing these steps, you should be able to upload .ico files through the WordPress Media Library without encountering errors related to file type restrictions.


