Notice: register_uninstall_hook was called incorrectly

I automatically updated my wordpress installation to the latest version. Everything looked normal unit "updating database..." where it got stuck. I waited for a long while and then closed the page, since nothing was happening.

Then I got a error message saying something about maintenance, which I got rid of after deleting the maintenance file.

Wordpress displays that it runs the latest version, but when I try to reinstall I get the same errror. I've tried disabling all plugins and switch to the default theme, but no luck.

I set the debug to true and I got this message: Notice: register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information.

Everything looks normal except a image on the front page is breaking the layout. Any tips?

Solutions

Some WordPress Plugin which you have installed is firing the uninstall hook and is not setup properly.

Can you find the path to the file from the error message?

The way I fixed this type of problem, was to do a global search in my project for the function call.

Some plugins had been installed which had calls such as this:

register_uninstall_hook(__FILE__, array($this,'uninstall_removedata'));

but it should be this:

register_uninstall_hook( __FILE__, 'uninstall_removedata');

If you see a message that something is called incorrectly, the Codex can be very helpful to make sure you use the correct syntax.

In this case it is here: http://codex.wordpress.org/Function_Reference/register_uninstall_hook

Similar questions

Getting notice is wordpress "WP_Scripts::localize was called incorrectly"
Complete message: Notice: WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.) in /home3/dduconne/public_html/wp-includes/functions.php o...
Notice: register_rest_route was called incorrectly. The REST API route definition for yoast/v1/get_head is missing the required permission_callback a
The site I'm working on is showing this issue on the posts/pages on the dashboard. "Notice: register_rest_route was called incorrectly. The REST API route definition for yoast/v1/get_head is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. "...
How can I delete options with register_uninstall_hook?
Right now, I have this code: But when I remove my plugin, all my options are there. (I made another plugin just to show my options). How can I delete options when plugin is removed?
register_uninstall_hook() vs uninstall.php - which one is better way to handle plugin uninstallation script?
today while looking inside WP Codex, I saw two ways to handle plugin uninstall scripts (like deletings, options, data, tables etc.). One way is using register_uninstall_hook() and the other is by using the simple uninstall.php. Though the codex page gives a lot of info about both of them, but it doesn't say what is the advantage of using one over a...
register_uninstall_hook not working on wordpress plugin uninstall
Hi there i make a plugin, now i want that when a user deactivate the plugin, all the functions and posts and option values and meta values also be deleted. I write a hook and make a file where i delete all the values, but it did not work, i use this hook Is there any other hook to use for this purpose. Here is my foo_uninstall.php code
Why my function in register_uninstall_hook from WP doesn't delete tables
I have this code in my WP plugin: And I have this function in class: If I uninstall my plugin, tables in DB are not deleted. Why?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy .