We use WPML plugin for WordPress. We would like it to be disabled when we access /wp-admin. Is this possible at all?
Furthermore, we've noticed an increase in page load time when a lot of content is present (due to the serialize and deserialize) so this makes the wp-admin interface unbearably slow.
Does anybody know how we can achieve this?
Try do do this:
add_action('admin_init', 'disable_wpml_for_admin');
function disable_wpml_for_admin() {
if (is_admin()) {
// don't forget to do for the same way for all wpml extensions
deactivate_plugins(
array(
'/wpml-translation-management/plugin.php'
),
true, // silent mode (no deactivation hooks fired)
false // network wide
);
}
}
It based on https://wordpress.stackexchange.com/questions/159085/deactivate-plugin-for-a-specific-user-group
I wanted to put get_current_screen()
function to check that we are in admin area, but description told us that it not defined on all admin pages and in some cases you will get error, that's why I check only is_admin()
— but it's mean that until you legged as admin even you are on client side — WPML will not work for you.