Stop WordPress editor embedding links

There are several posts about this, – but I suspect that it has changed after Gutenberg, since I can’t get either of the methods to work.

I’m trying to stop WordPress embedding links, when written in a post. I just want the regular link to display… Nice and blue as always. But it converts it to an Embed URL-object.

Attempt 1) I’ve tried:

function WPSE_dequeue_scripts(){
    wp_deregister_script('wp-embed');
}
add_action( 'wp_enqueue_scripts', 'WPSE_dequeue_scripts' );

Didn’t work. I can still see the wp-embed.min.js being loaded in the network-developer tab:

wp-embed.min.js in network tab

Attempt 2) I’ve also tried:

function WPSE_remove_shiftnav_assets(){
    remove_action( 'wp_enqueue_scripts' , 'wp-embed' , 9999 );
}
add_action( 'wp' , 'remove_shiftnav_assets' );

Even though I would strongly prefer something in my functions.php-file to remove this, then I’ve also tried this plugin here without any result either.

How do I stop it from auto-converting links to that Embed URL?

1 Answer
1

The quickfix: Copy the link into a text-editor and add a space before it. And then copy that new text (with the prefixed space) into whereever you want it.

Leave a Comment