Password Protecting Media

an additional solution that may work and require no coding is to insert the PDF into a post and just have the post protected. Then insert the post onto the page

Link to resized media file

You can use the get_the_post_thumbnail_url explained here So, the code would be <a href=”https://wordpress.stackexchange.com/questions/279104/<?php echo get_the_post_thumbnail_url(get_the_ID, array (2000, 1500) ) ?>” >……. </a>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)