Created
June 15, 2022 18:56
-
-
Save AntonioLeutsch/b067d25b4b88d59df5dce4bf22d63b43 to your computer and use it in GitHub Desktop.
Disable Download for Audio & Video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hide_download_buttons_on_embeds_render_block( $block_content, $block ) { | |
if ( 'core/audio' === $block['blockName'] ) { | |
$block_content = str_replace( | |
'<audio ', | |
'<audio controlsList="nodownload" ', | |
$block_content | |
); | |
} | |
if ( 'core/video' === $block['blockName'] ) { | |
$block_content = str_replace( | |
'<video ', | |
'<video controlsList="nodownload" ', | |
$block_content | |
); | |
} | |
return $block_content; | |
} | |
add_filter( 'render_block', 'hide_download_buttons_on_embeds_render_block', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original: https://kau-boys.de/4354/wordpress/download-button-fuer-audio-und-video-bloecke-ausblenden