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!
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
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; }
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!