Hello @teeboy4real
Sorry for the delay in response.
Please make sure you are using the latest version of the plugin and WordPress.
I have the latest version of Menu Icons and WordPress and I get the “The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.” error when trying to view the /wp-admin/nav-menus.php page of my site. Btw, this is actually a fatal error so I cannot use the Menu editor with the plugin enabled with the current state of things.
Enabling WP_DEBUG has the very same/similar notice that @teeboy4real has included here.
What was the solution for this, or is there a fix still in the works for this?
I found that it could be caused by a misconfigured parent/child theme setup.
The code that can have trouble is in includes/settings.php:
$menu_current_theme = '';
$theme = wp_get_theme();
if ( ! empty( $theme ) ) {
if ( is_child_theme() ) {
$menu_current_theme = $theme->parent()->get( 'Name' );
} else {
$menu_current_theme = $theme->get( 'Name' );
}
}
As https://codex.ww.wp.xz.cn/Class_Reference/WP_Theme#Methods mentions, the parent() method on wp_get_theme() returns false if no parent is available. Somehow, is_child_theme() is returning true while wp_get_theme()->parent() is returning false. Therefore, trying to run ->get( ‘Name’ ); on a false return isn’t possible & results in this error.
I know the theme setup should be revisited to prevent this issue, but sometimes that isn’t possible (someone without code experience is using a theme where this is a problem and the theme isn’t being udpated, etc.) As such, it seems like this could/should be implemented to simply prevent this issue even when it’s mostly on the theme setup’s end.
$menu_current_theme = '';
$theme = wp_get_theme();
if ( ! empty( $theme ) ) {
if ( is_child_theme() && $theme->parent() ) {
$menu_current_theme = $theme->parent()->get( 'Name' );
} else {
$menu_current_theme = $theme->get( 'Name' );
}
}
I can confirm that adding && $theme->parent() to the existing is_child_theme() fixes this potential error.
I’ve submitted this as a PR on GitHub at: https://github.com/Codeinwp/wp-menu-icons/pull/154
So, besides editing the plugin, will the author provide an update?
@mbzo2006 I’m unaware of a workaround other than making this code update to accommodate the condition of this issue.
I might also recommend reaching out via https://github.com/Codeinwp/wp-menu-icons/pull/154 (the official GitHub repo for this plugin) and stating your interest in having this solution officially implemented in a future version update for this plugin.
That being said, I am wondering what would be causing is_child_theme() to return true while wp_get_theme()->parent() returns false (causing this error). Please send what you find if you happen to come across a reason for this and/or a fix for this condition.
@poonam9 Any update on your end of things? It seems like a pretty straightforward issue and proposed fix with a PR having been submitted while it’s been a few months without a follow-up response on the matter.
-
This reply was modified 6 years, 8 months ago by
KZeni. Reason: Added message for @poonam9 regarding the status of things
This problem is still not fixed with the latest update
@teeboy4real I see the patch has been merged into the plugin on GitHub so I’d expect it to be resolved in the next version update.