Disable the Lightbox Scripts

You can easily disable the Lightbox scripts in Theme Panel > Scripts & Styles. But if for some reason, this panel doesn't work for you, here the solution to disable the Lightbox scripts:

 * Disable the Lightbox scripts
function my_enqueue_scripts() {

	// Unregister JS files
	wp_deregister_script( 'magnific-popup' );
	wp_deregister_script( 'oceanwp-lightbox' );

	// Unregister CSS file
	wp_deregister_style( 'magnific-popup' );

add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts', 99 );

 * Add the no-lightbox class in the body tag
function my_body_classes( $classes ) {

	$classes[] = 'no-lightbox';

	// Return classes
	return $classes;
add_filter( 'body_class', 'my_body_classes' );

All PHP snippets should be added via a child theme's functions.php file.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.