Total Theme: Call to undefined function wp_script_add_data FIX
Total & WP Bakery Page Builder are my favorite WordPress themes and builders.
Recently we started a new website design project, no different from any other apart from the this client had hosting with Melbourne IT. Once we installed WordPress and installed Total 4.9.3 we encountered the following error when trying to load the website front end.
Call to undefined function wp_script_add_data Total/framework/wp-actions/enqueue-scripts.php on line 127
This was the first time we have ever encountered an error after installing Total.
Installing WordPress – Where did it go wrong?
We installed WordPress using their automatic “Easy Install Apps” which installed WordPress version 4.1.1 Which was released in 2015. The installer seemed to think the latest version of PHP required was 5.0. So a big fat thanks for your outdated installer using a version of WordPress thats 5 years out of date. Certainly not a security risk for your clients or your servers.
Why the Total Front End / Website will not load
So the version to Total theme I used was 4.9.3 and I can only assume it contains functions that just don’t exist in the historical 2015 version of WordPress.
I was curious as to what specific line was causing the website not to load after Total was installed. So, I navigated to the folder Total/framework/wp-actions/ enqueue-scripts.php and to line 127:
wpex-html5shiv is a part of a WP Explorer function. and according to their changelog it was updated March 2015.
In order to get the website loading again we need to delete or rename the Total folder in /wp-content/themes/. I navigated to Melb IT’s 2012 file manager/explorer system that surprisingly loaded. (it usually never works).
And alas, the delete function seems to not work. Why am I not surprised?
If you want to delete the Total theme folder it looks like the only way will be FTP. If you can still login to the WordPress admin dashboard you could use delete option or just deactivate the theme.
As a test I tried to install a few different versions of Total that eventually created more errors and I could not even login to the WordPress dashboard.
Lets update WordPress
Move over WordPress 4.1.1, its time to update to WordPress 5.3.2.
This message isn’t so bad, most hosting providers will not auto update the version of PHP on the server.
From the hosting control panel navigate to Cloud Hosting >Advanced and scroll down to “Other Advanced Settings”.
Set the PHP version to the highest level that your WordPress installation supports.
If you are using cPanel based hosting, enter the search term “php” into cPanel’s search bar and select “Select PHP Version”.
Don’t stress if WordPress cannot see the new version and will not update right away. I find when you select a new PHP version it takes approximately 15 minutes to become active.
Once PHP was updated to 7.0, I was able to update WordPress to 5.3.2 and then install Total version 4.7.1.
Final Thoughts
If you run into the same issue after a fresh install or update of WordPress or a Theme I hope this has helped you out.
PS: Make sure you have a good hosting provider, Melbourne IT’s cloud hosting is just too far outdated for my liking and offers little to no control for most customers. There is no simple solution for downloading file and database backups, no auto SSL or even the standard Lets Encrypt Free SSL certificates that 90% of hosts now offer. Not to mention being heavily outdated.
Even a much smaller hosting company such as Velnetweb Share Hosting which uses the Hepsia control panel offers a much better ease of use.