Title: Adding links automatically
Last modified: December 1, 2016

---

# Adding links automatically

 *  Resolved [phildsgn](https://wordpress.org/support/users/phildsgn/)
 * (@phildsgn)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/adding-links-automatically/)
 * Hi there Josh,
 * is there a way to add links programmatically on the fly? Let’s say I have a function
   attached to a hook in my functions.php, in which I want to automatically cloak
   links. Does ThirstyAffiliates provide a function in the means of
    `add_new_link("
   http://some-external-url.com/some-article", "/recommends/your-affiliate-link")`
   or something like that?
 * Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Josh Kohlbach](https://wordpress.org/support/users/jkohlbach/)
 * (@jkohlbach)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/adding-links-automatically/#post-8504639)
 * Hi [@phildsgn](https://wordpress.org/support/users/phildsgn/),
 * Thanks for the question. You might be able to call quickCreateAffiliateLink()
   which is an AJAX function the Quick Add Affiliate Link functionality uses. You
   can find this on line 1969 in thirstyaffiliates.php. But keep in mind the user
   will need appropriate access and it must be called via AJAX.
 * Otherwise you can use that function as a model to roll your own function which
   calls [wp_insert_post](https://developer.wordpress.org/reference/functions/wp_insert_post/).
 * Hope this helps!
 * Cheers,
    Josh
 *  Thread Starter [phildsgn](https://wordpress.org/support/users/phildsgn/)
 * (@phildsgn)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/adding-links-automatically/#post-8505247)
 * Awesome! Thanks for the quick reply!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding links automatically’ is closed to new replies.

 * ![](https://ps.w.org/thirstyaffiliates/assets/icon-256x256.jpg?rev=2686825)
 * [ThirstyAffiliates - Affiliate Links, Link Branding, Link Tracking & Marketing Plugin](https://wordpress.org/plugins/thirstyaffiliates/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/thirstyaffiliates/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/thirstyaffiliates/)
 * [Active Topics](https://wordpress.org/support/plugin/thirstyaffiliates/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/thirstyaffiliates/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/thirstyaffiliates/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [phildsgn](https://wordpress.org/support/users/phildsgn/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/adding-links-automatically/#post-8505247)
 * Status: resolved