Wordpress php fatal error: Call to undefined funct

2019-06-22 05:09发布

How do I fix the following error.

Fatal error: Call to undefined function language_attributes()

4条回答
甜甜的少女心
2楼-- · 2019-06-22 05:49

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.

查看更多
时光不老,我们不散
3楼-- · 2019-06-22 05:59

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...)

查看更多
做个烂人
4楼-- · 2019-06-22 06:00

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.

查看更多
Melony?
5楼-- · 2019-06-22 06:04

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.

查看更多
登录 后发表回答