WordPress ThemePunch Revolution Slider PHP Line fix

and published
revolution slider php version fix

In this short tutorial, I will show you how you can fix the problem with upgrading the PHP error while using the WordPress plugin ThemePunch Revolution Slider. This fix covers PHP versions 5.6, 7.0, 7.1 and 7.2 upwards.

The reason that this problem occurs is that the PHP code within the Revolution Slider contains snippets of code that is now deprecated in later versions of PHP, particularly PHP5.5, often these errors are reported by WordPress in files db.class.php:29 and base_admin.class.php:70. Line 29 and 70 may vary depending on the version of the plugin installed on your website.

The easiest method to fix this problem is to purchase a newer version of this plugin, by doing so you will receive the newer code and more likely fewer security vulnerabilities. However, you may be on a tight budget and may just be looking for a quick band-aid fix! well, you came to the right place.

ThemePunch Revolution Slider PHP Fix

Enough of the introductions lets get on with fixing your website!

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 this 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 this code:

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

Replace it with this code:

private static $arrMetaBoxes = array();

Confused? watch WordPress ThemePunch Revolution Slider db.class.php Line Fix PHP 5.6 – 7.2+

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

15 Responses to “WordPress ThemePunch Revolution Slider PHP Line fix”

  1. Hi Simon,

    My provider changed all hosting packages to PHP version 7. My Problem is that pages with revolution slider won’t display correctly. I also could not log in in the backend of WordPress. I replaced the code as described above. Thankfully, I can log in to the backend but still, the pages with revolution slider won’t appear correctly. Any suggestion for solving the Problem? Many thanks in advance.

    Reply
  2. Maja Wall

    Thank you, Simon, you just saved me for an endless amount of work! Very much appreciated! Keep up the good straight forward problem-solving tutorials.

    Reply
  3. Manuel Prieto

    Thank you very much for this fix. I thought I might had to change the whole site.

    Reply
  4. César Noriega

    After I update my PHP version from PHP 5.6 to PHP 7.2, I encountered this issue, and this fix resolved my problem with the Revolution Slider. Thank You.

    Reply
    • Hi Cesar, I would need to know what version of Revolution Slider you are using since the procedure is likely to change from older version to new versions.

      Reply
  5. NEAGOE ANDREI

    Awesome!

    Reply
  6. Stefano

    Hi Simon, your suggestion for fixing the problem worked perfectly. Thank you very much!

    Reply
  7. Georges

    Hello Simon, I’ve been trying to fix this bug for a very long time and it’s thanks to you that I was finally able to solve it. Your solution to solve the problem worked perfectly for me. Many thanks!

    Reply
  8. Martin Jarvis

    Thanks Simon. This was hugely useful, and fixed my problem. I had a client on an outdated version of revslider and php 7.0. This was working fine, even though they should really upgrade the plugin. Applying your code changes mean that I can now move them to php 7.2.

    Reply
    • Hi Martin,

      Slider Revolution has had many updates over the years and continues even today. Most users that have no option within WordPress to update the plugin is often due to the fact they do not have a license which entitles them to free upgrades. There are many ways you can obtain Revslider without a full license but the main one is when bundled with a theme as these are limited licenses. You can purchase a full license on Envato: https://codecanyon.net/item/slider-revolution-responsive-wordpress-plugin/2751380

      Reply
      • Hi Simon.
        Thanks for the reply. Yes, I’m totally aware of all that, and I know it’s only $26, but some clients don’t want to upgrade and pay for various reasons. Thanks again for your help here.

        Reply