WordPress core code contains things marked as deprecated by… Wordpress?
-
15-03-2021 - |
Question
I have some problems matching this message in my WordPress network update page:
You have the latest version of WordPress. Future security updates will be applied automatically. If you need to re-install version 4.9.4, you can do so here:
With the one I just noticed after temporarily enabling debug mode:
Notice: wpdb::escape is deprecated since version 3.6.0! Use wpdb::prepare() or esc_sql() instead. in /home/user/public_html/blog.network/wp-includes/functions.php on line 3846
Notice: get_current_site_name is deprecated since version 3.9.0! Use get_current_site() instead. in /home/user/public_html/blog.network/wp-includes/functions.php on line 3846
What am I missing? How can core WordPress code still use code that its very own developers marked as deprecated? How can I update functions.php file in wp-includes to not use deprecated code and methods?
Solution
Line 3846 in wp-includes/functions.php
is in a function named _deprecated_function()
, which warns about the use of deprecated functions. I did a quick search of my copy of 4.9.4 core and didn't find any instances of wpdb->escape()
or get_current_site_name()
, the two functions you're actually being warned about.
Most likely, the deprecated functions are in a plugin or a theme. If you disable all plugins and switch to a default theme (such as Twenty Seventeen), the Notices should go away.