WordPress 5.4 – Call to undefined function is_favicon()

This one will be short. After a recent update to WordPress version 5.4, I noticed that “There has been a critical error on your website.”

In order to debug the site, I added define( 'WP_DEBUG', true ); in the wp-config.php file. What I saw was a little bit unexpected:

Fatal error: Uncaught Error: 
Call to undefined function is_favicon() in [wp-dir]/wp-includes/canonical.php:59 

Stack trace: 
#0 [wp-dir]/wp-includes/class-wp-hook.php(287): redirect_canonical('') 
#1 [wp-dir]/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) 
#2 [wp-dir]/wp-includes/plugin.php(478): WP_Hook->do_action(Array) 
#3 [wp-dir]/wp-includes/template-loader.php(13): do_action('template_redire…') 
#4 [wp-dir]/wp-blog-header.php(19): require_once('…') 
#5 [wp-dir]/index.php(17): require('…') 
#6 {main} thrown in [wp-dir]/wp-includes/canonical.php on line 59

All calls comming from the core of WordPress itself. No custom plugins, templates, hooks… So, the issue has to be related to the WordPress update itself.

The update I performed was the automatic one, the update you are able to force in the WordPress admin itself. The “is_favicon()” function that was not found is located in the wp-includes/class-wp-query.php file. This file was apparently not installed properly.

The “Re-install Now” button in the WordPress Update Dashboard was not helping either.

Manual update to the rescue

Since the automatic update was the source of the issue, I performed the manual update. I downloaded the WordPress installation, extracted it and updated all files in the WordPress installation directory.

Remember to back up your files before such an operation. Also, remember to keep your wp-config.php in place.

You should read the Manual Update instructions first 🙂