Skip to main content

Role

Date

January 9, 2020

Download the official Wordfence security plugin from: https://en-ca.wordpress.org/plugins/wordfence/
Upload the plugin to your wordpress but don’t activate it
Next, in your wordpress main dashboard head to Plugins -> Plugin Editor
In the “Select plugin to edit” bar choose Wordfence Security and press Select
Under the “lib file section” select the wordfenceClass.php file
Press ctrl+f and paste this:


if (!WFWAF_SUBDIRECTORY_INSTALL && $waf = wfWAF::getInstance()) {

You should see:


$updateCountries = false;
if (!WFWAF_SUBDIRECTORY_INSTALL && $waf = wfWAF::getInstance()) {
$homeurl = wfUtils::wpHomeURL();
$siteurl = wfUtils::wpSiteURL();

Now right under it paste this in:


wfConfig::set('isPaid', 1);
wfConfig::set('keyType', wfAPI::KEY_TYPE_PAID_CURRENT);
wfConfig::set('premiumNextRenew', time()+31536000);

So the code should look like this:


$updateCountries = false;
if (!WFWAF_SUBDIRECTORY_INSTALL && $waf = wfWAF::getInstance()) {
$homeurl = wfUtils::wpHomeURL();
$siteurl = wfUtils::wpSiteURL();

wfConfig::set('isPaid', 1);
wfConfig::set('keyType', wfAPI::KEY_TYPE_PAID_CURRENT);
wfConfig::set('premiumNextRenew', time()+31536000);

7. Save the file, then activate WordFence plugin, you should have unlimited premium license! It says “renew in 365 days” but you will notice that this number doesn’t go down 😉

If you can’t find the code, you can export the file, edit using notepad++ and then reupload or do something similar. You can also use FTP application to do this method.

© Ehsan Pourhadi - Digital Developer