I’m sick of having to put rel=”nofollow” and target=”_blank” into every tag when I’m posting (I am currently using WordPress 2.5.1 on my own host). I thought “there’s gotta be an easier way”. There must be a way I can edit the “link” button to add those html attributes automatically… There is.
This is how to edit a button on the WordPress composition panel:
Open the file wp-includes/js/quicktags.js in Wordpad (I don’t know the Mac equivalent). Notepad won’t let you see the file properly because it doesn’t read the line-breaks correctly.
Scroll down to the code where it says:
function edInsertLink(myField, i, defaultValue) {
if (!defaultValue) {
defaultValue = ‘http://’;
}
if (!edCheckOpenTags(i)) {
var URL = prompt(quicktagsL10n.enterURL, defaultValue);
if (URL) {
edButtons[i].tagStart = ‘<a href=”‘ + URL + ‘”>’;
edInsertTag(myField, i);
}
}
else {
edInsertTag(myField, i);
}
}
change the line:
edButtons[i].tagStart = ‘<a href=”‘ + URL + ‘”>’;
to read:
edButtons[i].tagStart = ‘<a href=”‘ + URL + ‘ rel=”nofollow” target=”_blank”>’;
save the file (ftp to your site) and you’re done! It’s that simple
One thing I just noticed… If you are using firefox and this solution doesn’t work for you, you need to clear the cache. Press Ctrl+Shift+Del, make sure “Cache” is selected, then press “Clear Private Data Now”. Refresh the page and this will work.