I am using WooCommerce & dokan as multivendor plugin. Sadly, by default Dokan don’t have the option to add Media files in product description like in WooCommerce.
I found a way to add “Add Media” option that exists in the normal WooCommerce description editor to here as well using this code:
add_action(‘dokan_product_short_description’, ‘add_demo_description’);
function add_demo_description(){
update_post_meta( get_the_ID(), '_desc', 'Lorem ipsum text' );
}
It actually works, I can add media library items and upload new ones through the Dokan vendor dashboard, and they also appear on the product page description, which is exactly what I need.
So now that users can add their Media in product description, I understood there is a new problem. the problem is that they can upload any file type here, which is not good because I don’t want people uploading weird stuff to the product description, the only relevant file in my case is MP3, That’s the only file type I want people to be able to insert into the product description.
It's also important to be able to limit file size and file amount, so trolls & bots won't be able to upload 10k files at 10gb each and destroy my server.
Any idea what I can do to ensure people can’t insert anything other than MP3 to the product description?
P.S: If you know of ways to style / change that default mp3 media player to something better that would be great.
Thank you!
// code here
. There's a Very high chance though that what you want to do requires Dokan specific knowledge that isn't solvable using general WordPress knowledge, which would make this question offtopic. 3rd party plugin/theme dev questions are offtopic on this stack. Update your question with the missing code and fix the image embedsfunctions.php
and your filter only updates post meta it doesn't modify anything else