# Bloquear download

**URL:** <https://tainacan.discourse.group/t/bloquear-download/2397>\
**Category:** Dúvidas\
**Created:** [Maio 9, 2025, 4:50pm UTC](https://tainacan.discourse.group/t/bloquear-download/2397 "2025-05-09T16:50:36Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![mateus.m.luna](https://yyz2.discourse-cdn.com/free1/user_avatar/tainacan.discourse.group/mateus.m.luna/32/3_2.png) [@mateus.m.luna](https://tainacan.discourse.group/u/mateus.m.luna)\
**Post date:** [Maio 13, 2025, 12:52pm UTC](https://tainacan.discourse.group/t/bloquear-download/2397/11 "2025-05-13T12:52:31Z")

</div>

Ive been revisiting this, and I believe there is a more official way for doing it. Internally our media gallery component calls an instance of the Tainacan embed class, which actually use [a WordPress filter](https://developer.wordpress.org/reference/functions/wp_embed_handler_audio/) to create the HTML `<audio>` tag. This means you could do something even more specific like:

```php
add_filter('wp_embed_handler_audio', function($audio, $attr, $url, $rawattr) {
	if ( ! empty( $attr['width'] ) ) {
	     $dimensions = sprintf( 'width="%d" ', (int) $attr['width'] );
    }	
    $audio = sprintf('<audio controls="" controlslist="nodownload" src="%s" %s></audio>', esc_url( $url ), $dimensions);	
    return $audio;
}, 9, 4);

```

You might wanna play with the ‘9’ value there, which is the priority of the filter, maybe 11 instead of 9 since our own code uses 10.

---

_[View the full topic](https://tainacan.discourse.group/t/bloquear-download/2397)._
