Fixing JavaScript Affiliate Links in Wordpress 2.1.1
Wordpress 2.1.1 was released yesterday so I took the time to upgrade my blogs to this latest version. Some of my sites were running 2.0.7, so I figured now was a good a time as any to get to the 2.1 release.
All was good, however, until I found out that any links created by JavaScript that were embedded inside of Wordpress posts or pages were creating a nasty spacing issue.
At some point between Wordpress 2.0.7 and 2.1.1 the developers decided it was a good idea to add the SCRIPT tag as an element that should get some extra spacing to make sure it looks good.
I’m fine with that, I guess, but there’s one major problem I have with this: some Commission Junction (CJ.com) affiliates require that links be JavaScript instead of normal A tags. As such, when you try to use these links in the flow of a Wordpress post or page with Wordpress 2.1.1 you get undesired spacing above and below the link.
As you can imagine this doesn’t flow well inside of the post or page, but thankfully there’s an easy way to fix the problem.
To fix this problem you’ll need to edit wp-includes/formatting.php. Go to line 59 and remove ‘|script’ from the $allblocks variable. Each of the items in this variable is delimited by a ‘|’ (pipe), so make sure you remove one of those along with the word ’script’.
Thankfully this is an easy thing to fix, but it’ll be a change you’ll have to do whenever you upgrade Wordpress in the future.
Tags: wordpress, 2.1.1, javascript, links, spacing issue, affiliate, cj, commision juncion
If you enjoyed this post, get free updates by email or RSS.

























Checkout These Related Posts
2 Comments so far »
Comment RSS · TrackBack URI
Leave a comment
Pingbacks/Trackbacks
Pingback on February 23 2007 @ 6:31 pm
Pingback on March 1 2007 @ 11:10 am