How to fix?...Wordpress Fatal error: Uncaught Error: Call to undefined function mysql_query() in /homepages

Hi, I am new to wordpress and was installing a plugin when I got this error, and am no longer able to go into Wordpress Dashboard to do anything.

A search in Google of similar errors seemed to suggest that I had got some kind of infection via the plugin.

Does anyone know how I can fix this please? Without being able to access the Wordpress dashboard I am clueless where to start! :confounded:

Many thanks in advance
Michelle

Full error:

Fatal error: Uncaught Error: Call to undefined function mysql_query() in /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-content/plugins/wp-content-layout/layout.php:22 Stack trace: #0 /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-includes/class-wp-hook.php(298): wcl_wpcontentlayout('') #1 /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array) #2 /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #3 /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-admin/includes/menu.php(149): do_action('admin_menu', '') #4 /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-admin/menu.php(283): require_once('/homepages/28/d...') #5 /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-admin/admin.php(138): require('/homepages/28/d...') #6 /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-admin/index.php(10): require_once('/homepages/28/d...') #7 in /homepages/28/d180278727/htdocs/clickandbuilds/SimplyCBD/wp-content/plugins/wp-content-layout/layout.php on line 22

Fixed, I removed the offending plugin via FTP and that fixed it :slight_smile:

2 Likes

Where did this plug in come from?
If it is still using mysql it must be very outdated.
No one should still be using mysql any more, it is obsolete and has been removed in PHP 7 and was deprecated in version 5.x.
What version of PHP is the server running? I’m guessing it will be 7 to get that error.
That plug in should be removed or updated.

1 Like

Plug in name was wp-content-layout. Not sure re our own PHP version, but it is a fresh install of Wordpress

It looks as though that plugin was last updated 2 years ago. Deffo one to avoid.

Two years ago it should not have been using mysql functions.

:+1:

This should tell you:-

echo 'Current PHP version: ' . phpversion();

This usually occurs when you go from an old version of PHP to a new version of PHP.

Old versions of PHP use mysql_*() API functions. These have been deprecated/retired for years now.

PHP-7.0 + PHP-7.1 have finally completely removed this code.

To resolve this, update your WordPress core + theme + plugins.

If problem persists, then enable WP_DEBUG in your wp-config.php file + you’ll get the exact line throwing the PHP Fatal.

If your Theme has the problem, you’re using a Theme which has been abandoned + you’ll have to change to a new Theme.

If any plugins show this problem, just disable them.

Since this type of error usually breaks the admin panel, you can disable plugins manually with FTP.

I normally do this for clients by creating wp-content/plugins-aside + moving the plugin directory causing Fatal from plugins to plugins-aside.

Once you’ve logged in, you can determine how to correct plugin problem, which will likely be replacing the plugin, as this type of problem usually means the plugin has been abandoned.

Yes it was the plugin - seems it was out of date. Thanks all!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.