Ahmad Naser Turnkey Ecosystem Ahmad Naser
June 12, 2018

Disable Plugins in WordPress, Thrive and WPML

Published in the Ahmad Naser ecosystem. Estimated reading time: 1 minute.

add_action('admin_footer', 'deactivate_some_plugins');
function deactivate_some_plugins($hook)
{
	global $wpdb;
	$screen = get_current_screen();
	//disable wpml in thrive admin dashboard
	if ( $screen->id == 'thrive-dashboard_page_tva_dashboard'){
		  wp_dequeue_script( 'wpml-select-2' );
define('ICL_DONT_LOAD_NAVIGATION_CSS', true);
define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
define('ICL_DONT_LOAD_LANGUAGES_JS', true);
}
	        return; // exit if incorrect screen id

        // do stuff if the page id is correct
}

Leave a Reply

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