# Plugin for embedding Discourse topics in wordpress pages or posts

**URL:** <https://meta.discourse.org/t/plugin-for-embedding-discourse-topics-in-wordpress-pages-or-posts/30228>\
**Category:** Plugin\
**Created:** [19 ביוני,‏ 2015,‏ 9:52pm UTC](https://meta.discourse.org/t/plugin-for-embedding-discourse-topics-in-wordpress-pages-or-posts/30228 "2015-06-19T21:52:24Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Matthieu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/matthieu/32/107885_2.png) [@Matthieu](https://meta.discourse.org/u/Matthieu)\
**Post date:** [21 ביוני,‏ 2015,‏ 8:48pm UTC](https://meta.discourse.org/t/plugin-for-embedding-discourse-topics-in-wordpress-pages-or-posts/30228/11 "2015-06-21T20:48:39Z")

</div>

Where is uploaded your images ? Is it on the discourse server or on amazon ?

Normally this ugly function do the job:

```plaintext
function add_base_url_to_link($cooked, $base_url){
  $relative_image_path = 'src="/uploads';
  $absolute_image_path = 'src="'.$base_url.'/uploads';
  $new_content = str_replace($relative_image_path, $absolute_image_path, $cooked, $count);

  $relative_user_avatar_path = 'src="/user_avatar';
  $absolute_user_avatar_path = 'src="'.$base_url.'/user_avatar';
  $new_content = str_replace($relative_user_avatar_path, $absolute_user_avatar_path, $new_content, $count);

  $relative_user_path = 'href="/users';
  $absolute_user_path = 'href="'.$base_url.'/users';
  $new_content = str_replace($relative_user_path, $absolute_user_path, $new_content, $count);

  return $new_content;
}

```

---

_[View the full topic](https://meta.discourse.org/t/plugin-for-embedding-discourse-topics-in-wordpress-pages-or-posts/30228)._
