If you use the Download Monitor plugin on your site to manage downloads and uploads, you can control its options using code snippets.
Download Monitor WordPress Plugin
The Download Monitor WordPress plugin supports multiple versions of the same file, as well as being able to insert downloads into posts, log and track downloads and for being able to sell downloads on your site.
To disable the force download, use this code snippet;
add_filter( 'dlm_do_not_force', '__return_true' );
By default, the Download Monitor plugin for WordPress will redirect empty downloads to the site’s homepage.
To disable the empty redirects for download, use this code snippet;
function dlm_disable_empty_download_redirect( $b ) {
return false;
}
add_filter( 'dlm_empty_download_redirect_enabled', 'dlm_disable_empty_download_redirect' );
To change the empty redirects for downloads from the homepage, you can use this code snippet and change the redirect URL as needed;
function dlm_custom_empty_download_redirect_url( $s ) {
return site_url('no-access');
}
add_filter( 'dlm_empty_download_redirect_url', 'dlm_custom_empty_download_redirect_url' );
MainWP offers a solid code snippets extension that will allow you to deploy and enable code snippets to all connected Child Sites.
Being able to control parts of Download Monitor using code snippets will allow those changes if needed to be made to all Child Sites that are connected to your MainWP dashboard.
Useful Links
- https://wordpress.org/plugins/download-monitor/
- https://www.download-monitor.com/kb-categories/advanced/
- https://www.download-monitor.com/kb/empty-download-request-redirection/
- https://www.download-monitor.com/kb/the-do_not_force-filter/
- https://mainwp.com/extension/code-snippets/
- https://kb.mainwp.com/docs/category/mainwp-extensions/code-snippets/