Reason for 3.6 add_menu() error and quickfix
-
Many have see this error after updating to WordPress 3.6:
Fatal error: Call to a member function add_menu() on a non-object in ../wp-content/plugins/wp-native-dashboard/langswitcher.php on line 28
The problem is the drop-down menu in admin bar of backend. If the drop-down menu is enabled in WP Native Dashboard settings “extend Backend Admin Bar with a language quick selector”, (options->enable_language_switcher), the error is triggered in WordPress 3.6 and no login is possible any more.
Technical reason: The drop-down menu is added via an ‘init’ hook while it should be added via an ‘admin_bar_menu’ hook, see also here.
As a complete fix is too complex for this forum, here a simple “quickfix” with one change which will remove / not add the drop down menu and avoid the error:
The fix requires FTP access and is done in line 24 of file
langswitcher.php
:Current version:
if(function_exists('is_admin_bar_showing') && is_admin_bar_showing() && $this->as_admin_bar) {
Quickfix:
if(is_object($wp_admin_bar) && function_exists('is_admin_bar_showing') && is_admin_bar_showing() && $this->as_admin_bar) {
Note: To still be able to change language in WordPress 3.6 backend, use “extend Personal Profile Settings with users prefered language”, (options->enable_profile_extension) setting of WP Native Dashboard for now…
- The topic ‘Reason for 3.6 add_menu() error and quickfix’ is closed to new replies.