Revolution Slider isn’t working on PHP 7.2 – WordPress

Hello Friends.
Now a days we all know that PHP 7.2 has been released and PHP 5.6 or older version will no longer receive any security updates or bug fixes. So it’s mandatory to upgrade our PHP Or WordPress websites on PHP 7.2 ASAP.

While upgrading the WordPress site on PHP 7.2 I just noticed that the plugin “Revolution Slider” has stopped working and it’s breaking the site. So after researching on this I found the solution as mentioned below.

Step 1: edit file db.class.php

Using SFTP, WordPress Plugin Editor or a file manager (cPanel/Plesk) edit /wp-content/plugins/revslider/inc_php/framework/db.class.php

Find the below code:


  private function checkForErrors($prefix = ""){
  if(mysql_error()){
    $query = $this->wpdb->last_query;
    $message = $this->wpdb->last_error;

    if($prefix) $message = $prefix.' - '.$message.'';
    if($query) $message .=  '--- Query: ' . $query;

      $this->throwError($message);
    }
  }

Replace it with this code:


private function checkForErrors($prefix = ""){
  if(function_exists('mysql_error')){
    if(mysql_error()){
      $query = $this->wpdb->last_query;
      $message = $this->wpdb->last_error;
      if($prefix) $message = $prefix.' - '.$message.'';
      if($query) $message .=  '--- Query: ' . $query;
      $this->throwError($message);
    }
  }
}

Step 2: edit file base_admin.class.php

Using your opted file editor, edit file /wp-content/plugins/revslider/inc_php/framework/base_admin.class.php

Find the below code:


private static $arrMetaBoxes = ""; //option boxes that will be added to post

Replace it with this code:


private static $arrMetaBoxes = array();

That’s it 🙂