While working on a project using WPML and user role editor, I ran into an issue where I could no longer access certain admin areas of WPML – with my administrator account. I needed a way to recreate the default WPML capabilities. Run this script as a plugin, navigate to any admin page, and then deactivate and uninstall.
<?php
/*
Plugin Name: Reset WPML Capabilities
Plugin URI: https://wpml.org/
Description: Reset WPML capabilities to default. Use when you have problem accessing areas of WPML. Just turn it on and go to any page. Turn off afterwards.
Version: 1.0
Author: Kevin Pryce
Author URI: https://kevinpryce.ca
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
class kpry_reset_wpml_capabilities
{
public function __construct()
{
add_action( 'shutdown', array( $this, 'reset_wpml_capabilities' ) );
}
public function reset_wpml_capabilities()
{
if ( function_exists( 'icl_enable_capabilities' ) ) {
icl_enable_capabilities();
}
}
}
new kpry_reset_wpml_capabilities();