AmazonSmile ProgramAmazon has a new program called AmazonSmile that donates .5% of a customer’s qualifying purchase to a charity of their choice.  Honestly, right now things are a little sketchy and it does not seem like all the bugs are worked out between the www and smile subdomain.  That being said – money to charity (small or large) is a good thing even if it requires a few extra clicks and logins.

The web content producing community is a little shaken though as a lot of us use Amazon’s Affiliate program to earn a couple extra bucks.  Personally, the amount received for this blog has never exceeded the amount used for toys to blog about but a few extra dollars for another Z-wave adapter is nice.

Amazon has stated in their affiliate FAQs that affiliates will be paid on products that are purchased through AmazonSmile as long as the url has been changed from to  This change is trivial for one link, but many people have them littered through their blogs.  If using WordPress, one option is to do a quick find/replace query on the wp_posts table.  In my case however, I always used shortened affiliate links.  The links look like  This added a step to the conversion process because you have to get the full url before replacing.

*** I added a plugin for people using normal affiliate links and widgets and not shorten Amazon links. ***

I still want charities to get money and I like testing new things so I ended up making a WordPress plugin to do my conversion to smile urls. I am not really sure how this “Smile” thing is going to work out so I didn’t want to make something permanent like a tool that manipulates the database (probably faster).

How the WordPress AmazonSmile plugin works:

  1. Adds a filter so the content is passed to a function.
  2. Content is searched for a shortened Amazon Affiliate Link.
  3. The ‘key’ is extracted from the url and checked against cache (more details on the caching in the source).
  4. If the end url is not found, the full url is grabbed, converted to smile and thrown into cache.

The plugin requires the get_headers() PHP function.  This function can be substituted with cURL.  With caching via W3 Total Cache and Cloudflare, the impact on performance should be very minimal while the urls are cached.  The url cache should float from page to page if you are using the same link on multiple pages and clean itself if you stop using the plugin.

If you also have regular Amazon affiliate links, you can change “return $content;” to “return str_replace($normal_url,$smile_url,$content);”.  I am not sure what will happen if you use this change with images or the affiliate widgets.  I believe it should be safe as Amazon’s tool links to a different subdomain.

General Word of Caution:

I am not 100% sure these links will work.  I am going completely off the documentation and faith in Amazon.  Use the plug in at your own risk.

At the time of writing, none of the links validate in their affiliate link checker.

Get the Code:

Get the AmazonSmile Shorten Link Affiliate Converter WordPress Plugin Code <- huge name.

*If you want to help test – feel free to click this link and then buy something from Amazon.


A sale has been recorded after I put in the Smile plug in.  I have also add the plugin to the plugin repository.



  1. Dwight Gingrich -

    Have you tried this recently? Is it still working fine? Given your hesitations in this article, I’m a little leery to experiment with my website unless updated confirmation is given that the plugin is working well.

    • Alison -

      Yep – working fine. It is used on this site.

      • gingrichdk -



Leave a Reply