Title: Php script &amp; outbound links
Last modified: August 31, 2016

---

# Php script & outbound links

 *  Resolved [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * (@krisrichens)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/php-script-outbound-links/)
 * Hi i have an affiliate link that has Php on the end of the code. I was wondering
   if there was any way of cloaking the full URL with the PHP.
 * I.E
 * [http://mysite.com/out.php%5Bphp%5Dusername%5B/php%5D](http://mysite.com/out.php%5Bphp%5Dusername%5B/php%5D)
 * I have for the life of me looked for a plugin as i have no access to the httacces
   file.
 * I know the PHP works as i have a plugin for to allow PHP. I know it works as 
   i have sent some usernames to the affilaite programme and they have tracked. 
   BUT when i use URL cloaker and other plugins the PHP script does not show.
 * Any help would be greatly appreciated.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/php-script-outbound-links/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/php-script-outbound-links/page/2/?output_format=md)

 *  [Eric Gunawan](https://wordpress.org/support/users/erricgunawan/)
 * (@erricgunawan)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996566)
 * Hi krisrichens,
 * What affiliate link cloaker plugin have you used?
 * Have you tried [https://wordpress.org/plugins/thirstyaffiliates/](https://wordpress.org/plugins/thirstyaffiliates/)?
 * Here’s a guide that might be useful:
    [http://www.wpbeginner.com/plugins/how-to-add-affiliate-links-in-wordpress-with-thirstyaffiliates/](http://www.wpbeginner.com/plugins/how-to-add-affiliate-links-in-wordpress-with-thirstyaffiliates/)
 *  [Doug Vanderweide](https://wordpress.org/support/users/dougvdotcom/)
 * (@dougvdotcom)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996567)
 * Any link shortener can do what you want. I am fond of [YOURLS](https://yourls.org/),
   which is written by longtime WordPress plugin developer Ozh.
 *  Thread Starter [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * (@krisrichens)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996573)
 * Thank You, however the links are not detecting the code i am using. If i use `[
   insert_php]global $user_ID;echo $user_ID;[/insert_php]`in my links using a url
   cloaker when tracking with an affiliate programme the whole script is loading.
   However outside of url cloakers if i use the affiliate link i.e copying this 
   code to a post [http://www.awin1.com/cread.php?awinmid=3133&awinaffid=226931&clickref=](http://www.awin1.com/cread.php?awinmid=3133&awinaffid=226931&clickref=)`[
   insert_php]global $user_ID;echo $user_ID;[/insert_php]` it shows the clickref
   as user id.
 *  [Eric Gunawan](https://wordpress.org/support/users/erricgunawan/)
 * (@erricgunawan)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996574)
 * Hi krisrichens,
 * Maybe I misunderstand your problem, but i’m trying to guess here:
 * Are you trying to put the PHP code:
    `global $user_ID; echo $user_ID;` on WordPress/
   HTML editor (i.e WordPress Content field or WordPress Plugin settings field in
   WP-Admin) ?
 * If so, i’m afraid it would never work.
    Since you should write PHP code only 
   directly in a PHP file.
 *  Thread Starter [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * (@krisrichens)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996575)
 * Sorry i should have mentioned i have installed Insert PHP (WP Plugin). When i
   hover over the url using the code above for example it shows [http://www.awin1.com/cread.php?awinmid=3133&awinaffid=226931&clickref=1](http://www.awin1.com/cread.php?awinmid=3133&awinaffid=226931&clickref=1)
   because i have used the `[insert_php]` shortcode. However i would like to insert
   global $user_ID;echo $user_ID; anywhere so it gets detected at the end to detect
   and change the url link then cloak it somehow (if that helps)
 *  [Eric Gunawan](https://wordpress.org/support/users/erricgunawan/)
 * (@erricgunawan)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996576)
 * > However i would like to insert global $user_ID;echo $user_ID; **anywhere** 
   > so it gets detected
 * By **anywhere**, where do you want to put the link at?
 * From looking at the Insert PHP plugin page [https://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/),
   i understand `[insert_php]` can only be used at Post and/or Page ?
 *  Thread Starter [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * (@krisrichens)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996577)
 * I would like to add $user_ID;echo $user_ID; at the end of the url so the user’s
   id is included on outbound links. But also i am looking to cloak the ugly url’s
   to my domain
 * Sorry for the confusion 🙂
 *  [Eric Gunawan](https://wordpress.org/support/users/erricgunawan/)
 * (@erricgunawan)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996578)
 * No problem.
 * Probably it’s just me who slow to understand your problem 🙂
 * What do you use for cloaking your URL ?
    Is it a plugin like i mentioned before
   above ?
 * If so, then you can’t put an `[insert_php]` on the cloak URL field in the settings
   screen, since it won’t work.
 * You can only use `[insert_php]` shortcode on a Post/Page like mentioned in the
   plugin description page. But you can’t use it somewhere else.
 * If you want to cloak your URL which has a dynamic value generated from PHP script,
   i’m afraid it can’t be done solely from WP-Admin HTML editor. But need to add
   some functions on your template/PHP files.
 * Hope I understand your problem and explain this matter well.
 * But if not, just shoot me another question again.
 *  Thread Starter [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * (@krisrichens)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996579)
 * No i think it is the way i write :).
 * I have used the cloaker mentoned above, and since posting this originally i do
   now have access to all the files (including the htacess file now) as i was having
   problems with my hosting site.
 * Just out of curiosity how would i go about adding the userid value and cloak 
   it?
 * If i could find a solution i would be over the moon 🙂
 * Best Regards
 *  [Eric Gunawan](https://wordpress.org/support/users/erricgunawan/)
 * (@erricgunawan)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996583)
 * Hi krisrichens,
 * I don’t think it could be done enough with a plugin or in standard HTML editor/
   settings field on WP-Admin.
 * At least you’ll need to get your hands dirty with PHP code etc.
 * And since i think it will be more than 1-2 lines of code, i can’t help you further
   with that.
    I’m really sorry about this.
 * Or probably, it’s just inexperienced me who’s trying to help you 🙂
    If that’s
   so, let’s hope anyone else can jump in and help you further with this.
 * Alternatively, if you have extra budgets, you’d probably want to try to post 
   it as a custom job/project in a place like [http://jobs.wordpress.net/](http://jobs.wordpress.net/)
   or such.
    Hopefully someone with more experiences can jump in and work your issue
   professionally.
 * Good luck and really hope you can resolve your issue.
 *  Thread Starter [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * (@krisrichens)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996587)
 * Thank you for replying. No worries. If it cannot be done then i will just dump
   the ptoject :).
 *  Thread Starter [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * (@krisrichens)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996588)
 * ALL FIXED! Yipee
 *  [Eric Gunawan](https://wordpress.org/support/users/erricgunawan/)
 * (@erricgunawan)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996589)
 * Glad to hear your issue is resolved, krisrichens 🙂
 * If it’s not too troublesome, would you mind sharing your solution with the community?
 * So in the future, if there are other users who face similar problem with yours,
   can have some helpful hints ?
 *  Thread Starter [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * (@krisrichens)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996623)
 * All i needed to do was create a new page with the php code in using meta redirect
   so the horrible link would not be shown 🙂 very simple and easy 🙂
 *  [Eric Gunawan](https://wordpress.org/support/users/erricgunawan/)
 * (@erricgunawan)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/#post-6996624)
 * Ah, it’s nice.
 * Thanks for posting your solution krisrichens 😊

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/php-script-outbound-links/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/php-script-outbound-links/page/2/?output_format=md)

The topic ‘Php script & outbound links’ is closed to new replies.

## Tags

 * [20q2016](https://wordpress.org/support/topic-tag/20q2016/)
 * [cloaking](https://wordpress.org/support/topic-tag/cloaking/)
 * [marketing](https://wordpress.org/support/topic-tag/marketing/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 3 participants
 * Last reply from: [krisrichens](https://wordpress.org/support/users/krisrichens/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/php-script-outbound-links/page/2/#post-6996635)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
