Yogesh Chauhan's Blog

Solution to “Call to undefined function mysql_error()” in RevSlider WordPress Plugin

in WordPress on February 12, 2021

Recently I was working on a website that has old RevSlider from 2014! It never got updated and the previous developers never cared to check or update the theme or the slider plugin.

Since WordPress is migrating to jQuery 3.x, I went to check into the site to make sure none of the plugins are dependent on jQuery and if they are, I need to add some fixes if the plugin devs don’t do anything.

Well, it turned out that none of the plugins were updated and it was running on old WordPress from 2014!

The people who developed the website couldn’t breathe without RevSlider plugin and I had to update everything. They bought the theme and the plugin came with it so they didn’t have a clue on what was going on. So, as soon as I updated the WordPress, the whole site broke into pieces!

So, I am going to add a quick fix that worked for me but first let’s see what the error looked like.

The error starts with “Fatal error: Uncaught Error: Call to undefined function mysql_error()”

My error was pointing to couple of files in the slider plugin directory.

The first error was base_admin.class.php which is located at wp-content/plugins/revslider/inc_php/framework/base_admin.class.php

The variable $arrMetaBoxes was defined as a string and I changed that variable to an array. your error should mention the line number as well.


$arrMetaBoxes = ""; // remove this

$arrMetaBoxes = array(); // add this 

The second error was pointing db.class.php which is located at wp-content/plugins/revslider/inc_php/framework/db.class.php

The function RevSlider is calling was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used.

On PHP official site, there is a mention of this error.

Here is the fix:


if(mysql_error()){ // remove this

if($this->wpdb->last_error){ // add this

Both of the errors mention the line number and variable so that it makes our job a bit easier (not a whole lot though).


Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
How to get Current Year, Month and Date in JavaScript?JavaScriptJSON.stringify() in JavaScriptJavaScriptWill SQL (Relational) Database become obsolete?SQL/MySQLSorting Arrays in JavaScriptJavaScriptHow to change HTML content on click using JavaScript?JavaScriptHow to position an image on top of another image using CSS?CSS