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 }

How to Require a Minimum Image Dimension for Uploading?

Add this code to your theme’s functions.php file, and it will limit minimum image dimentions add_filter(‘wp_handle_upload_prefilter’,’tc_handle_upload_prefilter’); function tc_handle_upload_prefilter($file) { $img=getimagesize($file[‘tmp_name’]); $minimum = array(‘width’ => ‘640’, ‘height’ => ‘480’); $width= $img[0]; $height =$img[1]; if ($width < $minimum[‘width’] ) return array(“error”=>”Image dimensions are too small. Minimum width is {$minimum[‘width’]}px. Uploaded image width is $width px”); elseif ($height … Read more

Media files exist in upload folder but not showing up

Just by uploading files into the wp-content/uploads won’t show up in the Media Library , those media ID’s needs to be there in the database to show up in the Media Library. If you already have files in the uploads folder and want to add them into the database, you can use this plugin to … 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

Limit image upload to one and disable audio, video and other document file types to upload

I was about to give up thinking that it wasn’t possible or at least easy and then I stumbled onto the wp_handle_upload_prefilter filter which gives you exactly what you asked for! Here’s the code: add_filter(‘wp_handle_upload_prefilter’, ‘yoursite_wp_handle_upload_prefilter’); function yoursite_wp_handle_upload_prefilter($file) { // This bit is for the flash uploader if ($file[‘type’]==’application/octet-stream’ && isset($file[‘tmp_name’])) { $file_size = getimagesize($file[‘tmp_name’]); … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş