Home > CMS Tutorial > WordPress > body text

What to do if a fatal error occurs when customizing themes and backgrounds in WordPress

藏色散人
Release: 2020-06-16 13:51:36
forward
4107 people have browsed it

The following column WordPress Tips will introduce to you the solutions to fatal errors when customizing themes and backgrounds in WordPress. I hope it will be helpful to friends in need!

What to do if a fatal error occurs when customizing themes and backgrounds in WordPress

If you open the WordPress customization and background menu, you will be prompted with a fatal error, similar to:

Fatal error: Uncaught Exception: Supplied nav_menu_item value missing property: description in xxxxxxxxxx/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php:183
Copy after login

You can try to solve it with the following code.

When trying to customize WordPress themes and backgrounds, a fatal error was encountered. Solution

Add the code to the current theme function template functions.php:

add_filter('wp_get_nav_menu_items', 'my_wp_get_nav_menu_items', 10, 3);
function my_wp_get_nav_menu_items($items, $menu, $args) {
foreach($items as $key => $item)
$items[$key]->description = '';
return $items;
}
Copy after login

After that, again The error disappears when opening the custom theme menu, but the code must remain in the theme. The problem still exists after removing it.

Another solution is to delete all menus previously created in the background, which can completely solve this problem, and then re-create the menus. I have never tried this method. If you have encountered similar problems with children's shoes, you can try it and there will be no loss.

The above is the detailed content of What to do if a fatal error occurs when customizing themes and backgrounds in WordPress. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:zmingcx.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template