opens pdf in new tab

Add this to functions.php and a pdf will open in a new tab

// opens pdf in new tab
function modify_attachment_link($markup) {
return preg_replace('/^]+)>(.*)$/', '2', $markup);
add_filter( 'wp_get_attachment_link', 'modify_attachment_link', 10, 6 );

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

© 2021 Jakob Helmer - Powered by WordPress - @trails&tribulations