Comprehensive Guide to Cracking the WPML Plugin and Removing Associated Notifications
“You are using an unregistered version of WPML and are not receiving compatibility and security updates. ”
Path:classes/setup/endpoints/licencestep.php
Instruction: Replace the contents of Licencestep.php
with the following code:
<?php
namespace WPML\Setup\Endpoint;
use OTGS_Installer_Subscription;
use WPML\Ajax\IHandler;
use WPML\API\Sanitize;
use WPML\Collect\Support\Collection;
use WPML\FP\Either;
use WPML\FP\Right;
use WPML\FP\Left;
use WPML\Plugins;
class LicenseStep implements IHandler {
const ACTION_REGISTER_SITE_KEY = ‘register-site-key’;
const ACTION_GET_SITE_TYPE = ‘get-site-type’;
public function run( Collection $data ) {
$action = $data->get( ‘action’ );
switch ( $action ) {
case self::ACTION_REGISTER_SITE_KEY:
return $this->register_site_key( $data );
case self::ACTION_GET_SITE_TYPE:
return $this->get_site_type();
default:
}
return $this->unexpectedError();
}
private function register_site_key( Collection $data ) {
$site_key = Sanitize::string( $data->get( ‘siteKey’ ) );
icl_set_setting( ‘site_key’, null, true ); // Clear existing key
// Bypass external validation and accept any key
icl_set_setting( ‘site_key’, $site_key, true ); // Save the key locally
$isTMAllowed = Plugins::updateTMAllowedOption(); // Update TM option
return Right::of(
[
‘isTMAllowed’ => $isTMAllowed,
‘msg’ => __( ‘Thank you for registering WPML on this site. You will receive automatic updates when new versions are available.’, ‘sitepress’ ),
]
);
}
private function get_site_type() {
// Return production type to avoid restrictions
return Right::of( OTGS_Installer_Subscription::SITE_KEY_TYPE_PRODUCTION );
}
private function unexpectedError() {
return Left::of(
__( ‘Server error. Please refresh and try again.’, ‘sitepress’ )
);
}
}
—
Next Step:
Use any site key you want – it will work.
—
Optional (to hide the registration error notice):
“You are using an unregistered version of WPML and are not receiving compatibility and security updates. ”
Add the following PHP snippet using a snippet plugin:
php
add_action( ‘plugins_loaded’, function () {
if ( class_exists( ‘\WPML\Installer\DisableRegisterNow’ ) ) {
$disable = new \WPML\Installer\DisableRegisterNow();
$disable->add_hooks();
}
} );