I started getting this error after pushing a staging site to live from Scriptaculous:
PHP Fatal error Uncaught Error: Call to undefined method Sensei_Blocks::has_sensei_blocks() in /.../wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/sensei-functions.php:38 Stack trace: #0 /.../wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei.php(1269): is_sensei() #1 /.../wp-includes/class-wp-hook.php(305): Sensei_Main->body_class(Array) #2 /.../wp-includes/plugin.php(189): WP_Hook->apply_filters(Array, Array) #3 /.../wp-includes/post-template.php(836): apply_filters('body_class', Array, Array) #4 /.../wp-includes/post-template.php(595): get_body_class(Array) #5 /.../wp-content/themes/astra/header.php(30): body_class() #6 /.../wp-includes/template.php(770): require_once('/...') #7 /.../wp-inclu in /.../wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/sensei-functions.php on line 38
My site uses the Sensei with WooCommerce Paid Courses plugin.
Option 1 (recommended): delete /wp-content/plugins/woothemes-sensei/plugins/sensei-lms/includes/class-sensei-blocks.php
Note: BACK UP your site before doing this, just in case this causes any issues. You can do this via FTP or by going into a web-based file manager such as cPanel’s File Manager app. How to backup WordPress easily
Option 2: uninstall and reinstall Sensei with WooCommerce Paid Courses
Note: You can’t simply upload the plugin over itself using Plugins > Add New. It will leave behind a class file which causes the error. BACK UP your site before doing this, just in case this causes any issues. How to backup WordPress easily
Why it broke
There are several situations which could cause this to happen, but the root of the issue is that Sensei LMS Version 3.12.0 no longer needs a class file which was included in previous versions. The file’s name and path are:
Since Sensei loads class files dynamically, it can wind up loading this unnecessary file and that causes the PHP Fatal Error during some function call (not sure the exact code which does this).
Possible situations which may lead to this issue:
- You used Scriptaculous to create a staging site, updated to a newer version of Sensei with WooCommerce Paid Courses in staging, then pushed the staging site to the live site. That was my situation.
- You updated the plugin in place through WordPress (Plugins > Add New > Upload File). Apparently WordPress doesn’t delete the plugin directory contents before unzipping the new woothemes-sensei.zip on top of it.
- Auto-updating may cause it, but I’m not sure. I don’t have a license for this plugin because I don’t need regular support or updates.
How to Backup WordPress Easily
I’m a huge fan of the Backup Migration plugin for this task. Just install, go to the Backup Migration tool, and click backup.