Call to undefined function is_blog_installed(), after creating functions.php

I’d like to place some custom code in functions.php which I’m unable to do so. Why am I getting the following errors after the creation of (even an empty) functions.php? I’m using WP 5.4.2 with Heroku-wp
?

Fatal error: Uncaught Error: Call to undefined function is_blog_installed() in /app/public.built/wp-includes/load.php:606 Stack trace: #0 /app/public.built/wp-settings.php(161): wp_not_installed() #1 /app/public.built/wp-config.php(255): require_once('/app/public.bui...') #2 /app/public.built/wp-load.php(37): require_once('/app/public.bui...') #3 /app/public.built/wp-blog-header.php(13): require_once('/app/public.bui...') #4 /app/public.built/index.php(17): require('/app/public.bui...') #5 {main} thrown in /app/public.built/wp-includes/load.php on line 606

Fatal error: Uncaught Error: Call to undefined function get_option() in /app/public.built/wp-includes/l10n.php:69 Stack trace: #0 /app/public.built/wp-includes/l10n.php(136): get_locale() #1 /app/public.built/wp-includes/l10n.php(756): determine_locale() #2 /app/public.built/wp-includes/class-wp-fatal-error-handler.php(41): load_default_textdomain() #3 [internal function]: WP_Fatal_Error_Handler->handle() #4 {main} thrown in /app/public.built/wp-includes/l10n.php on line 69

I’m editing public/wp-includes/functions.php file, not the core one. It used to work.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I’m editing public/wp-includes/functions.php file, not the core one. It used to work.

Ths is your problem, never modify files in the wp-includes folder under any circumstances!.

When tutorials and articles refer to functions.php, they’re referring to the functions file in the current theme. This file does not always exist but you can create it.

I would recommend you create a child theme, to avoid your changes being lost when that theme is updated. You can also create a plugin by placing a PHP file in the plugins folder, and placing a command at the top with /** Plugin Name: haxpanel's plugin **/ at the top. This will appear in the plugins list in the Admin dashboard for activation.

Before you do any of this though, fix your WP install by undoing the changes you made to wp-includes. Again, never modify the files of WordPress itself. The only time you should ever modify files in wp-admin or wp-includes is when you’re helping develop new WordPress releases. For personal sites, client sites, commercial or enterprise development, it is unnecessary, and in a lot of cases dangerous to modify those folders. Do not touch!


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x