Hide or Remove Download Option in WordPress Video Block

To Remove Download Option On The Video Block in WordPress To Secure Your Video Content and Enhance Your Website’s Professionalism.

Video content can be a vital part of your website, but unauthorized downloads can lead to your content being redistributed without your permission. Protecting your videos by disabling the download option is crucial. This guide will help you achieve that, ensuring your videos stay secure and only accessible through your site.

Why Disable the Download Option?

Before we delve into the technical steps, let’s discuss why you might want to disable the download option on your WordPress videos:

  1. Content Protection: Prevent unauthorized distribution of your intellectual property.
  2. Control: Ensure your content is viewed in the context you intend.
  3. Monetization: Protect revenue streams if you offer paid content.
  4. User Experience: Maintain a consistent user experience by keeping content on your site.
remove download link video 1024x579 1

Step-by-Step Guide to Removing the Download Option

Step 1: Using a Secure Video Hosting Service

One of the most straightforward methods is using a third-party video hosting service that offers advanced security features. Services like Vimeo and Wistia allow you to disable the download option.

  1. Upload Your Video: First, upload your video to a platform like Vimeo or Wistia.
  2. Adjust Privacy Settings: Go to the video’s settings and disable the download option.
  3. Embed the Video: Copy the embed code provided by the platform and paste it into your WordPress post or page using the Custom HTML block.

This method ensures users cannot download your videos directly from your site.

Step 2: Modifying WordPress Video Block Settings

For those who prefer to host videos directly on WordPress, a bit of custom code can help disable/remove download option.

  1. Edit Functions.php File: Navigate to Appearance > Theme Editor and open your theme’s functions.php file.
  2. Insert Custom Code: Add the following code snippet to hide the download button in the video controls:
<?php
/**
 * Ensure download option is hidden on all core video blocks
 */
add_filter( 'render_block', 'wd_video_block_render', 10, 2 );
function wd_video_block_render( $output, $block ) {
	 // make sure this only runs on the core/video block
     if ( 'core/video' !== $block['blockName'] ) {
          return $output;
     }
     // use str_replace to add controlslist nodownload markup
     $output = str_replace(
          '<video controls',
          '<video controls controlslist="nodownload"', $output
     );
     //return
     return $output;
}

This CSS code effectively remove download option from the video controls.

Prevent Direct Access Remove Download Option e1717751230878

Step 3: Using WordPress Plugins

Several plugins are designed to enhance video security on WordPress. Plugins like “Prevent Direct Access” or “WP Video Lightbox” can help.

  1. Install the Plugin: Go to Plugins > Add New, search for the plugin, install, and activate it.
  2. Configure Plugin Settings: Follow the plugin’s setup instructions to disable the download option for your videos.

ng a more personalized and effective optin process. Follow the steps outlined in this guide to set up your customized opt-in forms and watch your subscriber list grow.

Removing all video controls

The snippet below uses the same method, but adds some additional markup that will remove the three dots and all also remove download option that reside within it:

<?php
/**
 * Ensure download options are hidden on all core video blocks
 */
add_filter( 'render_block', 'wd_video_block_render', 10, 2 );
function wd_video_block_render( $output, $block ) {
	 // make sure this only runs on the core/video block
     if ( 'core/video' !== $block['blockName'] ) {
          return $output;
     }
     // use str_replace to add controlslist options to remove three dots
     $output = str_replace(
          '<video controls',
          '<video controls controlslist="nodownload noplaybackrate noremoteplayback" disablePictureInPicture', $output
     );
     //return
     return $output;
}

As you can see, I’ve added some additional markup to the output that will remove the playbackrate removeplayback and PictureInPicture options, which in turn removes the three dots UI completely.

Conclusion

By following these steps, you can successfully remove the download option on the video block in WordPress, protecting your valuable video content. Whether you choose to use a third-party video hosting service, add custom code, or install a dedicated plugin, each method provides a reliable way to secure your videos.

Remember, safeguarding your content not only protects your intellectual property but also enhances your site’s professionalism and user experience. Implement these changes today and keep your video content safe and secure

You could extend this as needed to add any other modifications you’d like to the html5 video markup.

Leave a Reply

noomaan_wordpress_developer-favicon-865f

Noman Ali

Noman Ali is web developer at Dev House, a custom software development agency focusing on high performance sites for web applications.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Other articles in this series

How to Seamlessly Add Facebook Comments in WordPress

Learn how to add Facebook comments in WordPress website to boost social engagement and simplify the commenting experience for your visitors. Step-by-step guide included.…

How to add Gutenberg Shortcodes in WordPress: A Comprehensive Guide

Unlock the power of Gutenberg shortcodes in WordPress to create dynamic, interactive, and SEO-friendly content. Learn how to use, customize, and optimize shortcodes for…

Learn Gutenberg Theme Development

Learn how to master Gutenberg theme development for WordPress with our comprehensive guide. Discover essential techniques, best practices, and advanced tips to create visually…

4 Easy Steps to Remove Core WordPress Blocks

Learn how to remove core WordPress blocks and improve your theme's design and functionality. Our guide provides detailed steps for unregistering unnecessary blocks.

Recommended Freeelancing Services