Notice: There is no legacy documentation available for this item, so you are seeing the current documentation.
The [affiliate_referral_url] shortcode can be used to output the referral URL of the currently logged in affiliate. When viewed, they will see the exact affiliate link to share of that specific page or post it is placed on.
Default Usage
[affiliate_referral_url]
Example:
http://yoursite.com/?ref=2
Custom URL
If you wish to provide a custom URL, you can do that by passing the URL into the shortcode:
[affiliate_referral_url url="http://yoursite.com/page"]
Example:
http://yoursite.com/page/?ref=2
Pro Tip: The Custom URL parameter is useful if you’d like to provide a list of URLs on your site for your affiliates to promote. This might be specific products or services, or perhaps a special sale or promotion. Each link will be formatted with that logged-in affiliate’s id or username already, so all they need to do is copy, paste, and go!
Pretty Affiliate URLs
If you have enabled Pretty Affiliate URLs from the AffiliateWP » Settings » Affiliates page, then the shortcode will inherit pretty URLs so there’s no need to add anything to the shortcode. However, if you’d like to override this you can use the pretty parameter:
Pretty URLs enabled:
[affiliate_referral_url pretty="yes"]
Example:
http://yoursite.com/ref/2
Pretty URLs disabled:
[affiliate_referral_url pretty="no"]
Example:
http://yoursite.com/?ref=2
Referral Format
By default the shortcode will also inherit the Default Referral Format option from the AffiliateWP » Settings » Affiliates page. This will either be ID or username. If you’d like to override this in the shortcode you can use the format parameter:
Referral Format set to ID:
[affiliate_referral_url format="id"]
Example:
http://yoursite.com/?ref=2
Referral Format set to username:
[affiliate_referral_url format="username"]
Example:
http://yoursite.com/?ref=john
Combining shortcode parameters
You can combine shortcode parameters for fine-tuned control:
Referral Format set to username with pretty URLs enabled:
[affiliate_referral_url format="username" pretty="yes"]
Example:
http://yoursite.com/ref/john
Referral Format set to ID with pretty URLs enabled with a custom URL
[affiliate_referral_url format="id" pretty="yes" url="http://yoursite.com/landing-page"]
Example:
http://yoursite.com/landing-page/ref/2
Note: You can only see the affiliate referral URL if you are logged in as an affiliate.