Setup Hotlink for Wordpress and nginx

Job ID: 31949355

Budget: $10 – $30 USD

I have a websites, and my websites have been grabbed by other websites
I want to use hotlink, so that when grabbing other websites, the contents are replaced with images and direct to my website, if not, I want to try setting banned automatically via cloudflare

i have use
location ~ \.(jpe?g|png|gif)$ {
valid_referers none blocked domain.com *.domain.com;
if ($invalid_referer) {
return 403;
}
}

and it didn't work
Related categories: PHP JavaScript Linux WordPress Nginx