Wordpress php fatal error: Call to undefined function language_attributes()?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 10:17:55

问题


How do I fix the following error.

Fatal error: Call to undefined function language_attributes()


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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



来源:https://stackoverflow.com/questions/1010586/wordpress-php-fatal-error-call-to-undefined-function-language-attributes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!