About MeArchivesHow TosWhat Is?Generate CashCase StudiesMediaResourcesMy SitesAdvertiseNewsletterContact

RE: WordPress MU – I can’t get any links to open in a new window (even if that option is selected). Do you think it’s a theme or installation issue?

March 18, 2008

Miscellaneous

I received an email today asking about how to open links in a new window in WordPress MU. I thought to myself that it should be the same way as regular WordPress, but she mentioned “even if that option is selected”. Assuming she meant she changed the Target option to “Open link in a new window” and it still didn’t work, there is something weird going on. Maybe it was in fact “a theme or installation issue”.

Turns out, that’s not it at all. It seems that in an effort to stay compliant with XHTML standards the WordPress MU folks (or folk) decided to eliminate the use of the target attribute in anchor tags. Whether that is the reason they eliminated it or not, the alternative way to open links in a new window is annoying…plus why the heck did they leave the option in the WYSIWYG editor? Well, for whatever reason, I’m glad they did. Getting the use of the target attribute back in anchor tags was a pretty simple fix.

There is a file called kses.php in the wp-includes folder. It apparently lists all the allowed HTML and anything not in there gets removed by the WYSIWYG editor. Just add it back in and your’e good to go….not 100% XHTML compliant but your links will be opening in a new window the old school way with no fancy scripting. After adding the target attribute back in as being “allowed” just follow the normal procedure you would to open links in a new window.

Adding TARGET To KSES.php

Download the file kses.php from the wp-includes folder. Make a backup of it. Open it and look for this block of text near the top of the file:

In the code above I added the , ‘target’=>array() part already. So, add that part, save it and re-upload. The visual editor shouldn’t strip TARGET out of your anchor tags anymore.

About Keith Lock

Keith has been in the affiliate marketing field for 10+ years working in a variety of niches along the way. His extensive technical background has allowed him to gain a significant advantage while marketing online. Keith primarily writes detailed step-by-step guides and product/service reviews in the make money online niche.

View all posts by Keith Lock

© Earn A Living Online in Your P-Jizzle's.

Subscribe

Subscribe to get alerted by e-mail when a new article is added.

Get Exclusive Money Making Tips:

Market Samurai Free

2 Responses to “RE: WordPress MU – I can’t get any links to open in a new window (even if that option is selected). Do you think it’s a theme or installation issue?”

  1. Jamie Says:

    Thank you so much for sharing this, Keith. This has been a major issue on our site since we launched in January, but thanks to your post, all is now well!

    Reply

  2. Keith James Lock Says:

    Glad to hear it Jamie…thanks for the comment

    Reply

Leave a Reply