Skip to content
Aug 7 / kkrizka

My First WordPress Plugin: Link Modder

The plug-in that I just wrote will help any blogger who makes money from different affiliate programs. Most affiliate programs require you to attach an reference ID when linking to their site to know who referred the visitor. For example, when I review any hardware and point to a website on NCIX, I have to append “?affiliateid=1234” to the end of the URL if I want to take credit for any sales.

This can get very tedious when you are writing a lot of links, and your ID is a random number. So I figured, why not automate the appending? That’s exactly what this plug-in does! It parses your posts, and looks for links to sites that you specified in the options. If it does any links, then it appends the query with your ID. It also checks if the post has any existing IDs, and overwrites them. Right now it is at a very early stage, but it works with most affiliates like Amazon and NCIX. However, support for more is coming in the future, so keep watching my blog for updates.

I implemented another requested feature in this plug-in called “auto link words”. This feature lets you specify keywords in your posts that will be turned into links in your post. The script ignores keywords that are already links, so you do not have to worry about existing links being modified.

These two features work together, so keywords turned links will also have your affiliate IDs attached. For example, every time you see the word NCIX in this post, both features were activated. First of all, the word was wrapped in link tags and made to point to http://www.ncix.com. Then the second part of the script detected that I am an affiliate, and added my affiliate ID to the link. This saved me a lot of work!

This is my first WordPress plug-in, so any feedback would be welcome. If you have any problems, or you would like additional features, leave a comment of contact me.

Installation Instructions

Download Version 0.1

NOTE: If you have more idea for new WordPress plug-ins, you should contact me. There is a very good chance that I will make it for you free of charge!

4 Comments

Leave a comment
  1. Aussie Poker / Aug 7 2007

    Excellent plug in

    Just started using it and it has taken buckets loads of work away.

    Excellent for improving internal linking too.

    Thank you

  2. Aussie Poker / Aug 9 2007

    I have found just one bug do far

    All ‘ are changed to ?

    Not sure if you can fix this but I have found it very useful but had to deavtivate it bacuase of this.

    • admin / Aug 9 2007

      Thanks for reporting it! I’ll take a look at it as soon I can, it’s probably some small typo in the code.

  3. Jay / Nov 15 2007

    Thanks for the plugin, however after activation I see this

    Warning: Invalid argument supplied for foreach() in /home/werunite/public_html/Jsblog/wp-content/plugins/link-modder.php on line 167

    Can you Advise?

Leave a comment
Cancel reply