Monday, November 11, 2019

Fixing an old Wordpress plugin to run on PHP 7

You should always update your CMS engine and individual plugins. Unfortunately this is not always possible especially when you have a non actively maintained website and you've used commercial theme or plugins.

In my case, I had to deal with an old Wordpress site which was updated but was still running on an older PHP version 5.6.40. Changing the PHP version  on the server to 7.3, the site broke with a sneaky Call to undefined function mysql_error() on the frontend and [] operator not supported for strings on the admin area. Both errors were caused from a plugin installed by the theme which doesn't support auto updates. More specifically Revslider 4.6.0 which looks like it was used by various themes in the past.
I had no other option but to try and fix them manually since I couldn't downgrade to older PHP version anymore nor invest more resource to change/update the theme and plugins.