How to add autolink plugin to TinyMCE in WordPress

Questo articolo รจ stato scritto oltre 1 years, il contenuto potrebbe essere datato.

So if you are like me with various editors and you gather tons of links (like for your Italian podcast) it can be handy a way to copy and paste in the WordPress editor a list of links and that they are autolinked.

TinyMCE that is the Classic Editor basically has a JS plugin that enable a non-complete autolink, I mean if you c&p doesn’t auto generate the link, you need to write something after the URL and it will generate the anchor.

The first step is to check what is the TinyMCE version used, we can do it looking on GitHub.

Next step is to download the autolink.min.js for that version like from here.

In conclusion you need to insert this code in your theme, as example, and put in the right folder the JS file.

add_filter('mce_external_plugins', 'add_tinymce_autolink_plugin');
function add_tinymce_autolink_plugin($plugins){
  $plugins['autolink'] = get_stylesheet_directory_uri().'/js/autolink.min.js';
  return $plugins;
}

 

Liked it? Take a second to support Mte90 on Patreon!
Become a patron at Patreon!

Leave a Reply

Your email address will not be published. Required fields are marked *