How to fix Fatal error after RankMath update

How to fix Fatal error after RankMath update

Today i will tell you “How to fix Fatal error after RankMath update”. Recently i was working on my website and i saw Fatal error. That error appeared after an update of RankMath in my Website was done.

How it started – The critical error

Starting from beginning, I updated RankMath plugin in my website and went to sleep, it was late night for me. Morning i noticed my website was not opening at all, It was showing “There has been critical error on your website”.

Error after RankMath update

Critical to Fatal error and WP database error

The first thing went to my mind what i updated yesterday that was RankMath plugin. Then i went to FTP and enabled the Debugging mode in WordPress.

Click here to know how to enable Debugging mode in WordPress

Once WordPress debugging mode was enabled i can see the error Which was Fatal error message and WordPress database error with some description of SQO queries and data, Saying about database connectivity error. Something like below:

WP Fatal error and WP database error

Nothing fixed the issue – Now what?

At this moment i was a bit panic and I was thinking what should I do? As my website was still down. I tried searching google with many queries but was not able to find any desired matching result. At last i found the solution some where on the web. But it asked to install some plugins but my website is still down.

First step towards the fix

Since i know RankMath got updated, i went to online file manager (You can visit your FTP) and deleted the RankMath folder and reloaded my website it was active again, Now i tried to install RankMath again, I was successful in doing so but i was not able to activate RankMath. I saw same message again but this time it was in dashboard and my website was running.

The fix for Fatal error after RankMath update

Now there is a open question “How to fix Fatal error after RankMath update”, Lets go ahead and fix the issue.

First of all take a complete backup of your website: Well we are not going to break anything but its wise to take a backup of all content before doing anything with your website.

  • At First you have to install a plugin Code Snippets, You can download it from here:
  • Install and activate it, Now Go to left side under “Snippets”, There click on ‘Add new’.
how to fix fatal error after rankmath update
how to fix fatal error after rankmath update
  • You will see a screen like below, Here give a title, then in the code section add this code
	function() {
  • Under that select “Only run in administration area”. Click on “Save changes and activate”.
how to fix fatal error after rankmath update wordpress code snippet settings
How to fix Fatal error after RankMath update – Code snippet settings
  • Now open WordPress Dashboard in a new window. Then deactivate recently created snippet from here
Turning of the code snippet after fixing the issue
  • Now just enable you plugin. You are done.

Please clear all the cache, including the server, after going through above steps. If you using CDN please purge it once.