For what security reasons are svgs blocked in the media uploader?

SVG can contain JavaScript. JavaScript can be used to hijack cookies or do other questionable actions. It can even be “hidden” in namespaces: <html xmlns:ø=”http://www.w3.org/1999/xhtml”> <ø:script src=”https://0x.lv/” /> </html> source It is very hard to filter that out during the upload, so it is just not allowed by default.

How to make “Upload files”selected by default in Insert Media?

Add this to your functions.php, or preferably a functionality plugin. add_action( ‘admin_footer-post-new.php’, ‘media_manager_default’ ); add_action( ‘admin_footer-post.php’, ‘media_manager_default’ ); function media_manager_default() { ?> <script type=”text/javascript”> jQuery(document).ready(function($){ wp.media.controller.Library.prototype.defaults.contentUserSetting=false; }); </script> <?php }

Prevent WordPress from generating medium_large 768px size of image uploads?

To remove the medium_large image size you can try to remove it with the intermediate_image_sizes filter: add_filter( ‘intermediate_image_sizes’, function( $sizes ) { return array_filter( $sizes, function( $val ) { return ‘medium_large’ !== $val; // Filter out ‘medium_large’ } ); } ); Not sure if you’re trying to remove all the intermediate sizes, but then you … Read more

wp.media.view.ImageDetails – Save settings as HTML5 data-* attributes for image

A way to do it is to use the (very convenient) editor:image-edit and editor:image-update events triggered by the tinymce wpeditimage plugin to get/set the dom directly (updated to wrap in wp_enqueue_media action): add_action( ‘wp_enqueue_media’, function () { add_action( ‘admin_footer’, function () { ?> <script type=”text/javascript”> jQuery(function ($) { if (wp && wp.media && wp.media.events) { … Read more

How to add new tab to media upload manager with custom set of images?

This is an old thread but for me still as still as relevant. I have been fiddling and has come up with this code for adding a media tab here, maybe someone want to continue for how the handle content for the tab? 🙂 add_action(‘admin_enqueue_scripts’, function(){ wp_enqueue_script( ‘my-media-tab’, plugin_dir_url( __FILE__ ) . ‘/js/mytab.js’, array( ‘jquery’ … Read more

tech