admin管理员组文章数量:1410697
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?
本文标签: filtersHow do I use removeaction on an addaction that uses an array
版权声明:本文标题:filters - How do I use remove_action on an add_action that uses an array? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744929331a2632797.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论