-1

I’ve just discovered that my wordpress site is throwing a critical error. I last published a post yesterday and it was fine. I haven’t made any changes to the site, code, themes, or plugins since then. But maybe there could have been an automatic update to wordpress or some other plugin.

With debugging on, this error message occurs both with and without all themes and plugins disabled:

Fatal error: Uncaught Error: Class "_WP_Dependency" not found in /home/tuhopymy/public_html/wp-includes/class-wp-dependencies.php:260 Stack trace: #0 /home/tuhopymy/public_html/wp-includes/script-loader.php(1609): WP_Dependencies->add() #1 /home/tuhopymy/public_html/wp-includes/class-wp-hook.php(324): wp_default_styles() #2 /home/tuhopymy/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #3 /home/tuhopymy/public_html/wp-includes/plugin.php(565): WP_Hook->do_action() #4 /home/tuhopymy/public_html/wp-includes/class-wp-styles.php(135): do_action_ref_array() #5 /home/tuhopymy/public_html/wp-includes/functions.wp-styles.php(24): WP_Styles->__construct() #6 /home/tuhopymy/public_html/wp-includes/functions.wp-styles.php(214): wp_styles() #7 /home/tuhopymy/public_html/wp-includes/blocks.php(296): wp_style_is() #8 /home/tuhopymy/public_html/wp-includes/blocks.php(682): register_block_style_handle() #9 /home/tuhopymy/public_html/wp-includes/blocks/legacy-widget.php(65): register_block_type_from_metadata() #10 /home/tuhopymy/public_html/wp-includes/class-wp-hook.php(324): register_block_core_legacy_widget() #11 /home/tuhopymy/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #12 /home/tuhopymy/public_html/wp-includes/plugin.php(517): WP_Hook->do_action() #13 /home/tuhopymy/public_html/wp-settings.php(727): do_action() #14 /home/tuhopymy/public_html/wp-config.php(112): require_once('/home/tuhopymy/...') #15 /home/tuhopymy/public_html/wp-load.php(50): require_once('/home/tuhopymy/...') #16 /home/tuhopymy/public_html/wp-blog-header.php(13): require_once('/home/tuhopymy/...') #17 /home/tuhopymy/public_html/index.php(17): require('/home/tuhopymy/...') #18 {main} thrown in /home/tuhopymy/public_html/wp-includes/class-wp-dependencies.php on line 260

There has been a critical error on this website.

I have no idea why this is happening or what to do. I didn't change anything, so there's nothing I can change back. What else can I do to resolve this?

2 Answers 2

2

The issue is as you already realized due to version change. You did not mention what version of Wordpress did you have and what version you changed into, so I will write a general description of the issue. If you wish a more particular description, then you need to provide the version that you had and the version that you have. _WP_Dependency was introduced in version 2.6.0, so it was likely not new for you, but you had a dependency that referred to it before it has been loaded. The issue happened inside wp-admin and/or wp-content, as their replacement fixed the issue for you. Hence it is very clear that if you still have your old version, maybe a version controller is in use there, then you can debug and see what the exact issue was.

However, you likely won't want to do that, because at the next version upgrade, if you get a similar issue, then the exact reasons will very likely be something else. So, instead of figuring out at each version update how your files have been corrupted exactly, a solution would be to use a version controller (or start using one if you did not already do it) so when you face similar issues you will apply the same solution as you did as a rule of thumb. But, very importantly, you should differentiate between Wordpress updates and your deploys, because if a Wordpress update happens to happen around the time of your deployment and things fail, then you will debug your deployment for days, only to realize that there was an update too.

A way for this differentiation is to switch Wordpress auto-update off, and do it when you are comfortable with doing it and making sure you don't do it when you also deploy your changes. You can also schedule auto updates and knowing the times of the auto updates you can make sure you don't do a deployment around those times and knowing this schedule your team can test whether anything was broken.

A better way to do it is to have a stage server where you have a scheduled auto-update, while auto-updates are false for your live version, so you can see whether anything is broken at the stage and if so, fix it before it's live.

Sign up to request clarification or add additional context in comments.

Comments

0

Replacing the wp-admin and wp-content folders from a fresh install solved the error (although I still have no idea what caused it).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.