Posts

Open PDF in new tabs – WordPress

To force WordPress to open all PDFs in a new tab, add the following to your theme-functions.php.

This code can be added as just the Script into the header.php of your site, though in certain interfaces it won’t always work.

Why would you use this?

We use WordPress as a College intranet that is then rendered as an iframe inside their management system SEQTA. This interface means that certain jQuery and Javascript won’t work as expected, specifically linking to pdfs.