Auto convert photos to WEBP (jpg, png)

/** * Konwertuj przesłane obrazy na format WebP * * Ten fragment kodu automatycznie konwertuje przesłane obrazy (JPEG, PNG, GIF) * do formatu WebP w WordPress. Idealny do umieszczenia w pliku functions.php motywu * lub do korzystania z wtyczek takich…Continue reading

Allow SVG/JPEG/WEBP/ICO/AVIF Files Upload

function allow_additional_mime_types($mime_types) { $mime_types[‘jpeg’] = ‘image/jpeg’; $mime_types[‘svg’] = ‘image/svg+xml’; $mime_types[‘webp’] = ‘image/webp’; $mime_types[‘avif’] = ‘image/avif’; $mime_types[‘ico’] = ‘image/vnd.microsoft.icon’; return $mime_types; } add_filter(‘upload_mimes’, ‘allow_additional_mime_types’);Continue reading

Allow WebP Files Upload

// Add WebP MIME type support function add_webp_mime_type($mime_types) { $mime_types[‘webp’] = ‘image/webp’; return $mime_types; } add_filter(‘upload_mimes’, ‘add_webp_mime_type’); // Enable WebP in the Media Library function enable_webp_upload($data, $file) { $file[‘ext’] = ‘webp’; return $data; } add_filter(‘wp_handle_upload_prefilter’, ‘enable_webp_upload’, 10, 2); // Enable…Continue reading

Allow Webp, SVG, ICO

function allow_additional_mime_types($mime_types) { $mime_types[‘svg’] = ‘image/svg+xml’; $mime_types[‘webp’] = ‘image/webp’; $mime_types[‘ico’] = ‘image/vnd.microsoft.icon’; return $mime_types; } add_filter(‘upload_mimes’, ‘allow_additional_mime_types’);Continue reading

Support for WebP Images

function g9_mime_types($mime_types) { $mime_types[‘webp’] = ‘image/webp’; //Adding webp extension return $mime_types; } add_filter(‘woocommerce_rest_allowed_image_mime_types’, ‘g9_mime_types’, 1, 1);Continue reading