[affiliate_referral_url]

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

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