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

How do I fix the following error.
Fatal error: Call to undefined function language_attributes()

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.

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.

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.

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

Related

Wordpress - PHP Fatal error: Interface 'Requests_Hooker' not found?

i am not able to access my wordpress frontend. After uploading the 'understrap' theme my backend and frontend throw an http 500 exception.
In order to debug the issue, i've set 'WP_DEBUG' to 'true' and receive the following exception:
PHP Fatal error: Interface 'Requests_Hooker' not found in /var/www/html/wp-includes/Requests/Hooks.php on line 15
Next, i've overwrite the complete "wp-includes" folder with an initial "wp-includes" from a new wordpess and now am able to access my backend again. Unfortunately, my frontend is still empty and in wp-content/debug.log is still the same exception.
Plugins, Themes and Uploads are not affecting the issue - that is sure (the first thing i did is to remove the uploaded theme - understrap).
Wp-uploads folder has been completely initialized.
Does anyone had this issue before and might know how to fix it? Any advice is highly appreciated.
I know this is an old request, but in case others have this issue, I found a solution today. It looks like someone deleted or renamed "Hooker.php" in "webroot/wp-includes/Requests". If you are able, I would recommend restoring a previous version of that file using whatever kind of control panel you are using to administrate your site.

Can't Access WordPress dashboard after update

I just updated a dev site I'm working on to the latest version of WordPress, immediately after doing so I can't access /wp-admin/
on /wp-admin/ I get this error on Chrome if DEBUG isn't turned on - "ERR_TOO_MANY_REDIRECTS"
Trying to access /wp-admin/admin.php I get a 404 error
If Debug is turned on in wp-config, I see the following on a blank page:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/*****/public_html/wp-includes/wp-db.php on line 1569
Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/wp-includes/wp-db.php:1569) in /home/heavy/public_html/wp-includes/pluggable.php on line 1216
I've tried removing all plugins, deleting HTACCESS & reverting it back to the default version, removing all customizations to functions.php, updated PHP version to 5.6 .. nothing is working.
Anyone have an idea of how I can further troubleshoot this?
Try in a different browser. Some browsers annoyingly cache redirects. The only way to truly find the underlying cause of this is to turn everything back to vanilla WordPress. 2017 theme, no plugins activated. Then systematically turn them back on to see which is causing the error. Often these kinds of errors are caused by poorly developed code "somewhere" in the code base (either as customisations within core WordPress files, which you should never do by the way, customisations in parent theme files, which again you should never do, customisations within plugins, which again you should never do. This type of error can also be caused by trailing white spaces in various PHP files, so think about what you've just customised and undo everything.
This is weird, but I get into similar issues. Can you try:
keep the plugins disabled
download a fresh new WP from wordpress.org and upload all its content except wp-content folder and note for difference between local files and distant files
be sure that .htaccess fits to your needs
open a browser that you never used on this website and go to /wp-admin
I also had this error because of WP UTF8 files containing BOM. I had to use a tool to remove it programmatically (something like this: https://github.com/GloryMind/Remove-bom-plugin-wordpress/blob/master/removed-bom.php).

Wordpress displaying old PHP errors

I have a WooCommerce website that has been created by other party. When I was editing a template file and checking a minor change, a PHP error appeared on top of the page (literally the first line in the document, above )
[12-Jun-2017 19:08:58 UTC] PHP Fatal error: Call to undefined function add_action() in /home/SITENAME/public_html/wp-content/themes/booklovers/widgets/top10.php on line 8
I do know what it means, but it appears that the error itself is not the issue. The time does not change, it constantly displays 19:08:58. I've also tried renaming/moving the file to see what happens - and nothing happens at all. It is being executed, because the page results with a white screen when I put exit; in it. Renaming made no difference. Checking this path by file_exists() called in index results with false. In my opinion it has something to do with Wordpress, because if I put exit; on top of the index.php the page is totally blank, without error, so it is not being merged with the response by Apache or something. Also setting the error reporting in index/config has no effect (I realize that this is generally a bad idea, and would not leave production with a workaround like this).
My guess is that the error might be some kind of a cached artifact. But this WooCommerce has no cache plugins installed so far... I have only a minor experience with Wordpress, I do know the basics, but debugging this type of issues is a terrible pain. I would appreciate any tips suggesting where should I look.
Additional information worth mentioning: shared hosting on GoDaddy (not my choice...), php 5.6.
Resolved. A theme's error_log file was being prepended to the response.

Fatal error: Call to undefined function wp_register_plugin_realpath()

I'm having an issue on an old site. This happened at random, and did not follow an upgrae or edit. I've followed the steps outlined in previous questions, including :
Renaming the plugins and adding them back in one by one to see if it fixes the issue.
Uploading a new plugins.php file from Wordpress' current build
Uploading a new settings.php file from Wordpress' current build
None of these things have fixed the issue...I only get more warnings. Any other ideas?
http://hoosierpma.com/
Make sure you're core version of WordPress is 3.9.0 or greater as the function was added then: docs on wp_register_plugin_realpath()
If you're on 3.9+, considering that modifying the plugins directory and core files had no impact there's a good chance code in the theme could be messing you up. Try changing to one of the default themes (twenty-fourteen for example) and see if you get the error. Also enable debugging mode in wp-config.php to see if you can get any more info on the error with the following command:
define('WP_DEBUG', true);

Joomla 2.5 and Global Configuration admin page

WE recently upgrade our site from Joomla 1.7 to Joomla 2.5. Everything seems to be working fine, except one single page, which is the global configuration page. See: http://imgur.com/Q9CQj
I have tried reuploading the administrator files and have checked permissions. Any idea?
I think the Javascript and CSS files used within the site changed but the names of these files remained the same. The upshot is that your web browser is continuing to use previously downloaded versions of the files.
It isn't the Joomla cache that it causing the issue - it is the browser cache. Next time you are in the /administrator/ area click the refresh/reload button while holding down the shift key on the keyboard. If you are using Google Chrome hold the Ctrl key instead - and you may have to do this twice - but no more. If it isn't working after two goes then the fault lies elsewhere.
If your problem isn't solved by the above - view the source of the HTML on the page that is a problem. You will probably find errors or warnings in the html that are breaking functionality. It may be that there is a fatal error somewhere towards the end of the page too - if this was output in the middle of a html tag it may not be visible until you view source.
Alternatively you may be hitting a fatal error and your server may be set to not show errors - in that case check your server's error log. Your hosting control panel may have a 'last 50 errors' output so if you log into your hosting control panel in one tab, trigger the error in another and then click through to the 'last 50 errors' area of the control panel you may be able to quickly see the cause of the issue.
Check your error log. I had my global configuration page looking exactly like yours. It turned out the errors was this:
PHP Fatal error: Cannot redeclare class JDatabaseMySQLi in /var/www/vhosts/example.com/httpdocs/libraries/joomla/database/database/mysqli.php original.backup on line 567, referer: http://www.example.com/administrator/index.php
I had a (1) file named mysqli.php original.php in /libraries/joomla/database/database which is a backup of mysqli.php in the same folder. It turns out joomla parses all files in the folder as php files and therefore the redeclare error. I put the file in a subdir and the problem was solved.

Categories