Rank Math uses REST API for saving metadata on your website. In case, if you’ve security plugins like Wordfence installed on your website and in an unlikely situation, if Rank Math’s REST routes are being blocked, then you should whitelist Rank Math in Wordfence.
In this knowledgebase tutorial, we’ll walk you through how to whitelist Rank Math in Wordfence.
Enabling Learning Mode in Wordfence
Wordfence Web Application Firewall would look for typical attack patterns on your website’s requests and then blocks them to secure your website. But at times, this could be a false positive, and Wordfence may block a functionality you’re using on your website.
To help Wordfence distinguish suspicious attacks and the functionality of your website, it comes with a feature called Learning Mode.
When you set Wordfence in Learning Mode, Wordfence will start to learn the requests you make on your website during day-to-day tasks, and any suspicious requests during this learning period will be automatically added to the Allowlist.
This could reduce the chances of Wordfence blocking your website’s regular functionalities. To set Wordfence in learning mode,
1 Open Wordfence Firewall Options
At first, head over to Wordfence → Firewall inside your WordPress admin area and then choose All Firewall Options.
2 Change Web Application Firewall Status
In the Firewall Options, scroll down to the Basic Firewall Options section. Under the Web Application Firewall Status, choose Learning Mode, as shown below.
You can also set up a date in the Automatically enable on field. Wordfence will be under Learning Mode until this date, and after that, Wordfence will enable protection.
Whitelisting Rank Math in Wordfence
You’ll have to whitelist the URL using the Live Traffic tool of WordFence to apply it to all the user-roles. To do so, navigate to WordFence → Tools → Live Traffic, as shown below.
Next, find the rule that got blocked by the firewall and click on ADD PARAM TO FIREWALL ALLOWLIST, as shown below.
Navigate to WordFence → Firewall → Web Application Firewall → Allowlisted URLs, and you can notice the URL in the Allowlist, as shown below.
And, that’s it! Now check if you’re able to save the metadata with Rank Math. If you’ve followed the above steps and still your Rank Math REST routes are being blocked by Wordfence, then feel free to open a support ticket directly from here, and we’re always here to help.