diff --git a/linkit.install b/linkit.install
index b212f8d..d8bbedd 100644
--- a/linkit.install
+++ b/linkit.install
@@ -81,6 +81,26 @@ function linkit_schema() {
 }
 
 /**
+ * Implements hook_install().
+ */
+function linkit_install() {
+  // Set module weight to ensure it runs after pre_render hooks are added by
+  // the WYSIWYG module, but only if it exists.
+  if (module_exists('wysiwyg')) {
+    $wysiwyg_module_weight = db_select('system', 's')
+      ->fields('s', array('weight'))
+      ->condition('name', 'texting', '=')
+      ->execute()
+      ->fetchField();
+
+    db_update('system')
+      ->fields(array('weight' => $wysiwyg_module_weight + 5))
+      ->condition('name', 'linkit')
+      ->execute();
+  }
+}
+
+/**
  * Migrate settings from v2 to v3 if needed.
  */
 function linkit_update_7300() {
@@ -221,3 +241,23 @@ function linkit_update_7302() {
     }
   }
 }
+
+/**
+ * Update the module weight.
+ */
+function linkit_update_7303() {
+  // Set module weight to ensure it runs after pre_render hooks are added by
+  // the WYSIWYG module, but only if it exists.
+  if (module_exists('wysiwyg')) {
+    $wysiwyg_module_weight = db_select('system', 's')
+      ->fields('s', array('weight'))
+      ->condition('name', 'texting', '=')
+      ->execute()
+      ->fetchField();
+
+    db_update('system')
+      ->fields(array('weight' => $wysiwyg_module_weight + 5))
+      ->condition('name', 'linkit')
+      ->execute();
+  }
+}
