专业WORDPRESS主题设计制作

WordPress自定义主题出现致命错误怎么办?添加代码解决(wordpress主题破解教程)

发布于: 2022-11-03

1 WordPress自定义主题出现致命错误怎么办?

  • 2 如何解决Supplied nav_menu_item value missing property: description’?

 

在本地电脑测试更换新WordPress主题,尝试自定义主题时,出现以下致命错误 ▼

wordpress-supplied-nav_menu_item-value-missing-property-description

WordPress自定义主题出现致命错误怎么办?

如果在打开WordPress自定义主题和背景菜单时,会遇到类似以下的致命错误:

Fatal error: Uncaught exception 'Exception' with message 'Supplied nav_menu_item value missing property: description' in D:\xampp\htdocs\wp\ceshimuban\wp-includes\customize\class-wp-customize-nav-menu-item-setting.php:183 Stack trace: #0 D:\xampp\htdocs\wp\ceshimuban\wp-includes\class-wp-customize-nav-menus.php(820): WP_Customize_Nav_Menu_Item_Setting->__construct(Object(WP_Customize_Manager), 'nav_menu_item[1...', Array) #1 [internal function]: WP_Customize_Nav_Menus->customize_register(Object(WP_Customize_Manager)) #2 D:\xampp\htdocs\wp\ceshimuban\wp-includes\class-wp-hook.php(303): call_user_func_array(Array, Array) #3 D:\xampp\htdocs\wp\ceshimuban\wp-includes\class-wp-hook.php(327): WP_Hook->apply_filters('', Array) #4 D:\xampp\htdocs\wp\ceshimuban\wp-includes\plugin.php(470): WP_Hook->do_action(Array) #5 D:\xampp\htdocs\wp\ceshimuban\wp-includes\class-wp-customize-manager.php(933): do_action('customize_regis...', Object(WP_Customize_Manager)) #6 [internal function]: WP_Customize_Manager->wp_loaded('') #7 D:\xampp\htd in D:\xampp\htdocs\wp\ceshimuban\wp-includes\customize\class-wp-customize-nav-menu-item-setting.php on line 183
There has been a critical error on this website. Please check your site admin email inbox for instructions.

Learn more about troubleshooting WordPress.

如何解决Supplied nav_menu_item value missing property: description’?

我们可以在WordPress主题的function.php文件中,添加以下代码修复它:

/**
* 解决WordPress自定义主题时出现致命错误 By 我们网站
* https://www.wordpressx.com/cwl-19302.html
**/
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;
}

我们经过测试,WordPress主题的function.php文件中,添加以上代码后,是可以解决WordPress Fatal error: Uncaught exception ‘Exception’ with message ‘Supplied nav_menu_item value missing property: description’的问题。

希望我们网站( https://www.wordpressx.com/ ) 分享的《WordPress自定义主题出现致命错误怎么办?添加代码解决》,对您有帮助。

TAG:
WP技术资料 wordpress模板制作、wordpress主题开发相关知识常见问题总结
MORE
服务电话:
0533-2765967

微信 13280692153