Returns the affiliate’s referral link.


slicewp_get_affiliate_url( $affiliate_id, $url = '' );
  • $affiliate_id (int)(required) – The affiliate’s ID.
  • $url (string)(optional) – A URL that replaces the base URL on which the referral URL is built upon. Defaults to empty string.


(string|null) The affiliate’s referral URL, or null if there’s no affiliate associated with the provided $affiliate_id or if the affiliate’s status is different than active.

More information

The URL that is returned when this function is called without the $url parameter is built from a base URL on top of which the plugin adds the affiliate query argument.

The base URL defaults to the value returned by WordPress’ site_url() function and can be modified using the slicewp_affiliate_url_base filter.


Get the affiliate’s default referral link

$referal_link = slicewp_get_affiliate_url( 10 );
// Returned value.

Get the affiliate referral link for a particular URL

$referal_link = slicewp_get_affiliate_url( 10, '' );
// Returned value.

Was this article helpful?

Do you have any feedback or suggestions to improve this page?

Can't find what you're looking for? We're here to help.

Contact us