WordPress Blog Sites Should Not Let Authors Upload Videos

Many WordPress blogging sites have faced the same question, whether to let bloggers upload videos to the same web server as your site, i.e. self-hosted videos. The answer is No! Especially if your website is hosted on a shared server. A high definition video files can easily exceed 100-200 MB, take up a lot of hard drive and memory but also demand bandwidth and other resources, quickly exceed the limits of the web server hosting your website, and overwhelm your website and other websites also hosted on the same server.

The best way to add video to your website is with a video hosting service such as YouTube. Let the blogger upload the video to a video hosting service first, then paste the video URL to embed the video in a WordPress post or page. This way videos will be streamed from video host’s global server network without using your website’s bandwidth. It will also increase the visibility of the video and your web site.

How can you stop bloggers from uploading videos to your site? On the WordPress blog site, add a snippet as follows.

function adjust_mime_types($mime_types){
unset($mime_types[‘mp4|m4v’]);  // block mp4 video
unset($mime_types[‘mov|qt’]); // block quicktime mov video
unset($mime_types[‘pdf’]); // block pdf files
return $mime_types;
add_filter(‘upload_mimes’, ‘adjust_mime_types’);

If bloggers upload a video MOV, they get the error message: “Sorry, you don’t have permission for this file type”

One thing worth noting is the MIME Type. If you look up the MIME Type of MOV online, you will get video/quicktime.

But the video/quicktime type doesn’t work in Snippet. Bloggers will still be able to upload videos. Only if the MIME type is defined in WordPress that can prevent video uploading. Where can you find these definitions? WordPress has a list of registered MIME types stored in wp-includes/functions.php for developers use wp_get_allowed_mime_types() getting MIME file types. These are MIME file types recognized by WordPress. By looking the functions.php source code, you will find that ‘mov|qt’ is for blocking video files with the MOV extension.



Leave a Reply

Your email address will not be published. Required fields are marked *

Verified by MonsterInsights