This is a messy question :) I'm running into a conflict between plugins and need to disable one (WP Bakery) on the front end of certain pages.
I'm looking at multiple questions on how to disable a plugin per page, but James Jackson's answer seems to be the best and most updated: (I don't want to use another plugin like Plugin Organizer to disable plugins).
It works by finding the actions used to load the plugin and then removes them with remove_action
, i.e.
`remove_action('wp_head', 'easy_fancybox_enqueue_styles');`
For my issue, the main file js_composer.php
of the WP Bakery plugin loads this file include/classes/core/class-vc-manager.php
and these are the actions in that file:
private function __construct() {
$dir = WPB_PLUGIN_DIR;
$this->setPaths( array(
'APP_ROOT' => $dir,
'WP_ROOT' => preg_replace( '/$\//', '', ABSPATH ),
'APP_DIR' => basename( plugin_basename( $dir ) ),
'CONFIG_DIR' => $dir . '/config',
'ASSETS_DIR' => $dir . '/assets',
'ASSETS_DIR_NAME' => 'assets',
'AUTOLOAD_DIR' => $dir . '/include/autoload',
'CORE_DIR' => $dir . '/include/classes/core',
'HELPERS_DIR' => $dir . '/include/helpers',
'SHORTCODES_DIR' => $dir . '/include/classes/shortcodes',
'SETTINGS_DIR' => $dir . '/include/classes/settings',
'TEMPLATES_DIR' => $dir . '/include/templates',
'EDITORS_DIR' => $dir . '/include/classes/editors',
'PARAMS_DIR' => $dir . '/include/params',
'UPDATERS_DIR' => $dir . '/include/classes/updaters',
'VENDORS_DIR' => $dir . '/include/classes/vendors',
'DEPRECATED_DIR' => $dir . '/include/classes/deprecated',
) );
// Load API
require_once $this->path( 'HELPERS_DIR', 'helpers_factory.php' );
require_once $this->path( 'HELPERS_DIR', 'helpers.php' );
require_once $this->path( 'DEPRECATED_DIR', 'interfaces.php' );
require_once $this->path( 'CORE_DIR', 'class-vc-sort.php' ); // used by wpb-map
require_once $this->path( 'CORE_DIR', 'class-wpb-map.php' );
require_once $this->path( 'CORE_DIR', 'class-vc-shared-library.php' );
require_once $this->path( 'HELPERS_DIR', 'helpers_api.php' );
require_once $this->path( 'DEPRECATED_DIR', 'helpers_deprecated.php' );
require_once $this->path( 'PARAMS_DIR', 'params.php' );
require_once $this->path( 'AUTOLOAD_DIR', 'vc-shortcode-autoloader.php' );
require_once $this->path( 'SHORTCODES_DIR', 'core/class-vc-shortcodes-manager.php' );
// Add hooks
add_action( 'plugins_loaded', array(
$this,
'pluginsLoaded',
), 9 );
add_action( 'init', array(
$this,
'init',
), 11 );
$this->setPluginName( $this->path( 'APP_DIR', 'js_composer.php' ) );
register_activation_hook( WPB_PLUGIN_FILE, array(
$this,
'activationHook',
) );
}
The add_action
calls are not specific and use arrays.
How can I use remove_action
on add_action( 'plugins_loaded'
?
Os is there a way to disable the entire private function __construct
?
Is there a better way to try to disable this plugin on certain pages?