5
votes

How do I fix the following error.

Fatal error: Call to undefined function language_attributes()

4
Reminds me of Yahoo! Answers. All the questions are phrased as declarative sentences with question marks at the end. - Travis

4 Answers

1
votes

It looks as if your theme either did not upload correctly, or it is not compatible with the version of wordpress that you are using.

1
votes

This can happen if you have no wp-config.php file. Rename the wp-config-sample.php file to wp-config.php, edit the db-settings and try again.

1
votes

What version of WP are you using? From my research I found that the language_attributes() function is a new feature as of WP 2.1. If you are using a version of Wordpress older than 2.1 then you can either remove the function call from your header.php file or upgrade your wordpress installation.

0
votes

This error occurs because the function language_attributes() is unavailable. If you are seeing it in the logs but your site is working fine, it might just be that someone tried to access a file in your theme directly.

Files in the theme directory are normally accessed after WordPress has loaded (making a bunch of functions available, like language_attributes()). If you try to access them directly, for instance by visiting yoursite.com/wp-content/themes/yourtheme/header.php in your web browser, you should see an empty page, and an error should be logged (e.g. in the error_log file).

Other files will trigger slightly different errors, depending of what functions these documents are calling. On a site I just tested, if I hit mytheme/index.php a Call to undefined function get_header()... error is logged.

If you see this error in the logs but are not experiencing any issues, it's probably due to some bot or indelicate user snooping around. You can ignore the error (unless you have a ton of them, in which case you might want to install a security plugin just in case...)