March 18th, 2008
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?
written by Keith James Lock
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.
| 2.5 |
Did You Know...
- I made a quick and very easy $55 on Wigix - Read more
- Jonathan Volk doesn't pay his affiliates - Read more
|
Subscribe & Share |
Did You Miss Any Of These? |

The video shows 145 hours of work being done in only 12 minutes.






March 20th, 2008 at 12:05 pm
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!