Notifications
Clear all

Video Hide menu "download" from video player

1 Posts
1 Users
0 Reactions
14 Views
Posts: 1
 fufy
Topic starter
(@fufy)
New Member
Joined: 6 hours ago

I have this code in my wordpress theme's functions.php to disable download menu from video player which works great on my posts, i.e. video plays normally and has all functions except the download menu - just what I need.

add_filter( 'render_block', 'video_block_render', 10, 2 );
function video_block_render( $output, $block ) {
    if ( 'core/video' !== $block['blockName'] ) {
      return $output;
    }
    $output = str_replace(
      '<video controls',
        '<video controls controlslist="nodownload"', $output
    );
    return $output;
}

But in wpForo posts, the video player's download menu shows normally. Not sure if there's anything from wpForo that overcomes or has higher priorty that blocks this function not working properly. I've also tried adding the code to wpForo's functions.php instead of Wordpress's but didn't work either.

Please kindly advise.

 

Many thanks.