Suddenly Getting Fatal Error: Uncaught Error [...] for undefined function in mu-plugins which I haven't touched in a long time

I suddenly started getting the following error, and I’m not sure how to troubleshoot this:

Fatal error: Uncaught Error: Call to undefined function register_extended_post_type() in
/app/public/wp-content/mu-plugins/red-egg/custom-post-types/case-study.php:9 Stack trace: 
#0 /app/public/wp-includes/class-wp-hook.php(286): {closure}('') #1 /app/public/wp- 
includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #2 /app/public/wp- 
includes/plugin.php(465): WP_Hook->do_action(Array) #3 /app/public/wp-settings.php(525): 
do_action('init') #4 /app/public/wp-config.php(78): require_once('/app/public/wp-...') #5 
/app/public/wp-load.php(37): require_once('/app/public/wp-...') #6 /app/public/wp- 
admin/admin.php(34): require_once('/app/public/wp-...') #7 /app/public/wp-admin/themes.php(10): 
require_once('/app/public/wp-...') #8 {main} thrown in /app/public/wp-content/mu-plugins/red- 
egg/custom-post-types/case-study.php on line 9

I’ll get this error when I leave the code I had previously to register CPTs in the mu-plugins folder. I registered these many months ago and haven’t touched these files since. But now, for some reason the error points to the function used to register them. If I remove the code in my mu-plugins folder that registers CPTs, then it seems I can at least access /wp-admin and no longer see error above. I can also change to the Twenty Nineteen theme and it will display just fine. When I switch to my Sage theme and try to view the site, the error doesn’t display but I get a completely blank/empty page:

The blank page isn’t giving me much to work off here and I’ve never received an error like this in my short time working with Sage. I’ve seen that this error isn’t uncommon and that others have posted similar issues, but many seem to point specifically to a class/namespace issue and/or could be on different configurations or previous versions of Sage. So curious if anyone has any advice on what might be causing the error.

Again, I didn’t make any changes to the files inside mu-plugins to register my CPTs, but if you think this code may be helpful I can provide it.

Happy to share whatever other information will help, but not sure where to start.

check your .gitignore file and the code at your github repo, there is a chance your folder red-egg/ is not there.

hm, I am getting the same error Uncaught Error: Call to undefined function register_extended_post_type()

(I have fixed .gitignore file, all missing files are there on github and remote server.)

I ran into this problem after an update, the fix was to run ‘composer dump-autoload’ from the theme folder.

I tried ‘composer dump-autoload’, provisioned and deployed again -
now I am getting ‘Unable to connect’ error.

I can’t even see an HTML error page anymore, both access.log and error.log are 0 bytes.

Tried to provision and deploy my old roots-example-project.com to the same droplet - it worked.
Is it OK to provision and deploy different local projects to the same droplet?

TLDR: For me at least, it seems that reinstalling yarn and updating node-sass was the main thing that resolved it. Although it took some guessing and trying a lot of random things before getting there.

@kpoxo6op I don’t think this was an issue with my .gitignore at all. It seems more like something resulting from an update to the local environment. I’m using Local by Flywheel and wondering if something changed there, but not really sure. @blu I ran composer dump-autoload and got Generated autoload files containing 0 classes. Not sure what this did exactly.

In WP admin I also noticed this message that the theme is broke and missing styles in node_modules:

47%20AM

Somewhere along the way I started getting errors with yarn build that pointed to my version of node-sass and I updated node-sass to @4.12.0. Then, after updating and when yarn build was successful, my site came back. Everything looks to be the way I left it and working from what I can tell.

1 Like

@abgregs how did you update your node-sass to @4.12.0? What commands did you run overall?

From theme root yarn upgrade node-sass@4.12.0. To check the upgrade you can run yarn outdated to see a list of packages and current version installed:

30%20AM

In my case, if I didn’t specify a version with @version or --latest flag and simply ran yarn upgrade node-sass then my project package.json wasn’t updating. Hope that helps.

1 Like

thanks this is not my case, will create a separate topic :face_with_monocle:

Okay, sorry it didn’t help and best of luck!

This topic was automatically closed after 42 days. New replies are no longer allowed.