Skip to content

Instantly share code, notes, and snippets.

@alanef
Created November 7, 2019 10:29
Show Gist options
  • Select an option

  • Save alanef/4b849ac6914a4527f7e04b40c940d0af to your computer and use it in GitHub Desktop.

Select an option

Save alanef/4b849ac6914a4527f7e04b40c940d0af to your computer and use it in GitHub Desktop.
Disable WP BAkery on WooCommerce Shop page
<?php
/**
* Must use plugin that deactivates WP Bakery on the shop page only
*/
// Don't allow direct execution
if ( ! defined( 'WPINC' ) ) {
die;
}
$request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
add_filter( 'option_active_plugins', function ( $plugins ) use ( $request_uri ) {
if ( false === strpos( $request_uri, '/shop/' ) ) {
return $plugins;
}
if ( false !== ( $i = array_search( "js_composer/js_composer.php", $plugins ) ) ) {
unset( $plugins[ $i ] );
}
return $plugins;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment