Harm10 on "[Plugin: Media Library Assistant] Problem with upload_mimes hook"

ساخت وبلاگ

Hi! I am trying to add a mime type in the regular way.
But this fails for some reason. If I switch off MLA the add is executed correctly.
Looking at the hook upload_mimes its active filters are:

>>>>> upload_mimes
10 check_upload_mimes wpuxss_eml_upload_mimes remark_add_mime_types
2147483647 MLAMime::mla_upload_mimes_filter (2)

As I am adding svg and MLA also does something with that I also tried adding a funny mime type to no avail.

My code:

// Add mime types
function remark_add_mime_types($mimes) { $mimes['svg'] = 'image/svg+xml'; $mimes['harm'] = 'text/plain'; retu $mimes;
}
add_filter('upload_mimes', 'remark_add_mime_types');

https://wordpress.org/plugins/media-library-assistant/

Thanks for your report and for posting your code.

The current MLA version does a one-time processing of registered MIME types when it is first loaded, captures everything at that point, then takes over from there. It does not go back to the upload_mimes filter on subsequent page loads.

The $mimes['svg'] = 'image/svg+xml'; type is already present in the MLA list. You can easily add the $mimes['harm'] = 'text/plain'; type on the Settings/Media Library Assistant Uploads tab. Once that's done you will have both types in the supported/active MIME types list. If you inactivate MLA your filter will take over and provide the same outcome.

I am marking this topic resolved, but please update it if you have any problems or further questions regarding MLA's MIME type support. Thanks for your continued interest in the plugin.

I understand your reasoning but I simply think your capturing shouldn't result in the impossibility of other code (for example other plug-ins) to be executed properly. On what priority is your capturing executed? If every other code has a higher priority than that the setting (or unsetting) will be correct.
I haven't checked what filter wpuxss_eml_upload_mimes is supposed to do but will that be blocked too?

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 89 تاريخ : جمعه 3 ارديبهشت 1395 ساعت: 2:46