Archived topic
Links no longer open external links in new tab
1 reply · Started by Ashley on October 8, 2019
Hi. I recently switched from Divi to GeneratePress. When I had Divi, all external links in a post opened in a new tab. Switching to GeneratePress seems to have reset all my links and external links now open in the same window, which is not good.
I have more than 500 posts on my website so I don't want to through and manually change all the links. Is there a better way to do this?
Thanks
Hi there,
GP definitely doesn't alter your existing content/HTML when the theme is activated - we would get in a lot of trouble for that :)
I've actually explained it in your previous topic here:
https://generatepress.com/forums/topic/switching-to-generatepress-broke-tons-of-my-links/#post-1024632
It's possible that Divi is running a script to make all the links open in a new tab.
I found a few solutions that seem promising on Google:
https://html.com/attributes/a-target/
https://bogdandragomir.com/blog/2016/12/add-target-_blank-attribute-external-anchors-page-javascript-jquery-one-single-line/
https://stackoverflow.com/questions/804256/how-do-i-add-target-blank-to-a-link-within-a-specified-div