Title: Adding external, dynamically created links to posts
Last modified: January 30, 2017

---

# Adding external, dynamically created links to posts

 *  [kflavin21](https://wordpress.org/support/users/kflavin21/)
 * (@kflavin21)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/adding-external-dynamically-created-links-to-posts/)
 * I have a very simple custom plugin I’ve written which dynamically adds scheduled/
   published posts to a separate forum on my site (non-Wordpress forum). In other
   words, a writer posts an article, and the article in turn is posted to our forum.
 * I’d like to be able to “grab” the link created by the forum, and link it from
   within my wordpress post, from this same plugin. Assuming I’m already able to
   get that link from within my plugin, how can I go about adding it to the bottom
   of my post?
    -  This topic was modified 9 years, 4 months ago by [kflavin21](https://wordpress.org/support/users/kflavin21/).

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

 *  [wee-beastie](https://wordpress.org/support/users/wee-beastie/)
 * (@wee-beastie)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/adding-external-dynamically-created-links-to-posts/#post-8723314)
 * Can you be more specific about where the trouble is occurring? Are you having
   trouble associating the link with the correct post? Are you unsure of how to 
   modify your theme?
 *  Thread Starter [kflavin21](https://wordpress.org/support/users/kflavin21/)
 * (@kflavin21)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/adding-external-dynamically-created-links-to-posts/#post-8723410)
 * I was trying to figure out the best way to store the data, retrieve it, and then
   display it in the template.
 * I think I found what I was looking for though:
    [https://codex.wordpress.org/Function_Reference/add_post_meta](https://codex.wordpress.org/Function_Reference/add_post_meta)
 * It looks like I can just add my URL as metadata for each post, and retrieve it
   for display on my theme.
 * One question – when a post is deleted, does all associated metadata get removed,
   or do I need to handle removing any metadata I add?
 *  [wee-beastie](https://wordpress.org/support/users/wee-beastie/)
 * (@wee-beastie)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/adding-external-dynamically-created-links-to-posts/#post-8723449)
 * Yes, there is a good chance saving the link as custom post meta is what I would
   do as well.
 * Also, yes, my understanding is that when a post is deleted (not trashed), the
   associated meta gets deleted with it.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/adding-external-dynamically-created-links-to-posts/#post-8726486)
 * I can confirm the meta data is deleted with the post as long as the WP admin 
   screens are used to delete, or the wp_delete_post() function is used. If the 
   post is deleted by some other shortcut method, the meta data would likely stay.
 * Also removed are related comments, revisions, and assigned taxonomy terms.
 *  [wee-beastie](https://wordpress.org/support/users/wee-beastie/)
 * (@wee-beastie)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/adding-external-dynamically-created-links-to-posts/#post-8726668)
 * Oh one more little thing. Be sure to give `update_post_meta()` a look as well.
   I often prefer using that over `add_post_meta()` to avoid duplicate meta key/
   values.
 * [https://codex.wordpress.org/Function_Reference/update_post_meta](https://codex.wordpress.org/Function_Reference/update_post_meta)
 *  Thread Starter [kflavin21](https://wordpress.org/support/users/kflavin21/)
 * (@kflavin21)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/adding-external-dynamically-created-links-to-posts/#post-8728251)
 * Great, thanks! I’ve been able to get something going – good to know I’m on the
   right track.
 * I’ll check out using update_post_meta() as well. I think that makes sense for
   my situation.

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

The topic ‘Adding external, dynamically created links to posts’ is closed to new
replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 6 replies
 * 3 participants
 * Last reply from: [kflavin21](https://wordpress.org/support/users/kflavin21/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/adding-external-dynamically-created-links-to-posts/#post-8728251)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
