Hey @duffldofflo,
Thank you for reaching out! You could use this particular code snippet to strip out the “/partner” part from the referral URLs.
function slicewp_custom_get_affiliate_url( $url ) {
$url = str_replace( '/partner', '', $url );
return $url;
}
add_filter( 'slicewp_get_affiliate_url', 'slicewp_custom_get_affiliate_url' );
The “slicewp_get_affiliate_url” filter is used in the “slicewp_get_affiliate_url()” function and you can use it to modify the affiliate’s referral URL.
Even so, please note that the hook’s intent is to add additional parameters, not remove them. However, considering that you’re using a redirection plugin to redirect to the correct referral URL, the above solution should work nicely.
Thank you and best wishes,
Mihai
-
This reply was modified 1 year, 3 months ago by
iova.mihai.
Hi Mihai,
wow, thank you!
I tested it, and it works perfectly!
Do I understand correctly: This snippet removes the /partner part from the URL that is shown in the settings (e.g. where the affiliate can copy his url / see his QR code) – but the actually working referral URL will still have to be with the /partner part as this is technically necessary – right?
So I need to take care of creating a redirection from “short URL” to “long URL” else it wont work – just as I am doing right now, and this works well.
But I have been creating the redirections manually, so now I want to automate the creation of the redirections. I have a snippet that will append the redirection directives at the end of my .htaccess file.
I now just need a hook with which to start the snippet execution.
Is there a hook in SliceWP that I can use?
Like “affiliate created” or “affiliate edited” or “affiliate deleted” (the latter I would use to find and delete the according redirection in the .htaccess file).
Thank you and regards
Thomas
-
This reply was modified 1 year, 2 months ago by
duffldofflo.
-
This reply was modified 1 year, 2 months ago by
duffldofflo. Reason: I forgot a part of my question
Hey @duffldofflo,
Yep, you’ve got everything right. And yes, we do have action hooks for what you need. These are: slicewp_insert_affiliate, slicewp_update_affiliate, slicewp_delete_affiliate
All three actions will pass the affiliate’s unique ID as the first parameter.
Thank you and best wishes,
Mihai