disable a wp javascript on live website, but not on wp-admin page

I have a wp javascript, wp-embed.min.js, disabled on my WordPress theme by adding this sample code to my theme’s function.php file:

add_action( ‘wp_print_scripts’, ‘my_deregister_javascript’, 100 );

function my_deregister_javascript() {
wp_deregister_script( ‘wp-embed’ );
}

The problem is that the javascript is disabled everywhere, including in the wp-admin page, and one of the plugins I want to use requires it to work.

Is there a way to disable a specific wordpress javascript only on the live website, but not on wp-admin pages?

Thanks

Read more here:: disable a wp javascript on live website, but not on wp-admin page

Leave a Reply

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