Answers.Body: <p>I don't think there's an easy way to do this natively in Craft.</p>
  
  <p>Maybe you could pull it off with combination of <a href="https://github.com/lindseydiloreto/craft-cpcss" rel="nofollow noreferrer">https://github.com/lindseydiloreto/craft-cpcss</a> and/or <a href="https://github.com/lindseydiloreto/craft-cpcjs" rel="nofollow noreferrer">https://github.com/lindseydiloreto/craft-cpcjs</a> and manipulate the DOM directly.</p>
  
  <p>Or maybe by going from the Redactor site and listening to their <a href="https://imperavi.com/redactor/docs/callbacks/events/#callback-click" rel="nofollow noreferrer">click</a> event.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-03T22:09:29.603Z
Answers.LastActivityDate: 2016-11-03T22:09:29.603Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>Turns out, this is very easy to do in Craft 3!</p>
  
  <p><a href="https://github.com/craftcms/redactor/issues/146#issuecomment-501862773" rel="nofollow noreferrer">https://github.com/craftcms/redactor/issues/146#issuecomment-501862773</a></p>
  
  <p>Using a custom module, you can implement code similar to this...</p>
  
  <pre class="lang-php prettyprint-override"><code>use craft\redactor\events\RegisterLinkOptionsEvent;
  use craft\redactor\Field as RedactorField;
  use yii\base\Event;
  
  // Remove "Link to..." Redactor links
  Event::on(
      RedactorField::class,
      RedactorField::EVENT_REGISTER_LINK_OPTIONS,
      function(RegisterLinkOptionsEvent $event) {
  
          // Only apply to a specific Redactor config
          if ('Message.json' == $event-&gt;sender-&gt;redactorConfig) {
  
              // Remove Craft's injected links
              $event-&gt;linkOptions = [];
  
          }
  
      }
  );
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-13T20:22:50.437Z
Answers.LastActivityDate: 2019-06-13T20:22:50.437Z
Answers.UserDisplayName: Lindsey D
Answers.Body: <p>In craft->app->fieldtypes->RichTextFieldType.php there is a function called _getLinkOptions. In there if you just return an empty array, there will only be the option to link to a URL.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-26T16:03:20.533Z
Answers.Text: Please do NOT do this. Any updates you make to the `craft/app` folder could be removed when you run Craft updates. Brad's answer about using a plugin is the best solution.
Answers.UserDisplayName: Jamie Wade
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-27T23:26:12.350Z
Answers.Text: Sometimes people need a solution. If you have control of updates and keep track of what you've changed it's really not a big deal. Can people be trusted to use their own discretion?
Answers.UserDisplayName: Dexterity
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-26T15:59:42.730Z
Answers.LastActivityDate: 2017-01-26T15:59:42.730Z
Answers.UserDisplayName: Dexterity
Body: <p>Is there a way to remove the 2 Craft specific menu items from Redactor's Link menu without losing access to the "Insert link" menu item?</p>
  
  <p>Removing the Link button in the redactor configs is too draconian as I don't want to lose access to the basic Insert and Unlink functions previously in that menu. </p>
  
  <p>I've dug into the src, and the only hook/event I can find related to the redactor settings allows addition of menu items to the Links menu, but not removal of the Craft added "Link to an Entry" and "Link to a Category". </p>
  
  <p><a href="https://i.sstatic.net/Td9Ux.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Td9Ux.png" alt="Rich text field with link menu exposed with menu items crossed out."></a></p>
  
Tags: <redactor><richtext>
Title: How to remove Link To Category from Redactor
ThreadText: # How to remove Link To Category from Redactor
  
  (Asked by: username_0 on 2016-11-03)
  
  Is there a way to remove the 2 Craft specific menu items from Redactor's Link menu without losing access to the "Insert link" menu item?
  
  Removing the Link button in the redactor configs is too draconian as I don't want to lose access to the basic Insert and Unlink functions previously in that menu.
  
  I've dug into the src, and the only hook/event I can find related to the redactor settings allows addition of menu items to the Links menu, but not removal of the Craft added "Link to an Entry" and "Link to a Category".
  
  [![Rich text field with link menu exposed with menu items crossed out.](https://i.sstatic.net/Td9Ux.png)](https://i.sstatic.net/Td9Ux.png)
  
  **Tags:** redactor, richtext
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-11-03. Score: 1 | Accepted answer
  
  I don't think there's an easy way to do this natively in Craft.
  
  Maybe you could pull it off with combination of <https://github.com/lindseydiloreto/craft-cpcss> and/or <https://github.com/lindseydiloreto/craft-cpcjs> and manipulate the DOM directly.
  
  Or maybe by going from the Redactor site and listening to their [click](https://imperavi.com/redactor/docs/callbacks/events/#callback-click) event.
  
  
  ---
  
  ### Answer by username_2 on 2019-06-13. Score: 1
  
  Turns out, this is very easy to do in Craft 3!
  
  <https://github.com/craftcms/redactor/issues/146#issuecomment-501862773>
  
  Using a custom module, you can implement code similar to this...
  
  ```php
  use craft\redactor\events\RegisterLinkOptionsEvent;
  use craft\redactor\Field as RedactorField;
  use yii\base\Event;
  
  // Remove "Link to..." Redactor links
  Event::on(
      RedactorField::class,
      RedactorField::EVENT_REGISTER_LINK_OPTIONS,
      function(RegisterLinkOptionsEvent $event) {
  
          // Only apply to a specific Redactor config
          if ('Message.json' == $event->sender->redactorConfig) {
  
              // Remove Craft's injected links
              $event->linkOptions = [];
  
          }
  
      }
  );
  
  ```
  
  
  ---
  
  ### Answer by username_3 on 2017-01-26. Score: -2
  
  In craft->app->fieldtypes->RichTextFieldType.php there is a function called \_getLinkOptions. In there if you just return an empty array, there will only be the option to link to a URL.
  
  > **Comments:**
  > **username_4**: Please do NOT do this. Any updates you make to the `craft/app` folder could be removed when you run Craft updates. username_1's answer about using a plugin is the best solution.  
  > **username_3**: Sometimes people need a solution. If you have control of updates and keep track of what you've changed it's really not a big deal. Can people be trusted to use their own discretion?  
  
  ---
  
  