Last Updated on November 14, 2020 by Kings
WordPress is one of the best CMS for file and content uploads and downloads, because of it’s easy use and stability a lot of content creators from different segment make use of wordpress. If you ever wanted an onclick download of file on your wordpress site instead of opening on a new tab, keep reading as i will show you a very simple way to do that.
How To Onclick Download Files on WordPress
How To Force File Download in WordPress via Htaccess
<FilesMatch “.(?i:mp3)$”> ForceType application/octet-stream Header set Content-Disposition attachment </FilesMatch>
You can replace mp4 with whatever file type you want it to download and if you want to add force download to multiple files then add the below code to your htaccess file
For easier access to editing htaccess you can make use of wordpress Htaccess Editor
I will also update this post on another method to force files to download (not open in browser) soon.