您好,我该怎么办?我在“管理”面板的“自定义”面板上不知何故出现以下错误。通常菜单上没有问题。我只有在进入自定义页面以直播主题直播时才会出错。
Fatal error: Uncaught exception \'Exception\' with message \'Supplied nav_menu_item value missing property: target\' in L:\\UwAmp\\www\\Wordpress\\News\\wp-includes\\customize\\class-wp-customize-nav-menu-item-setting.php on line 183
我在本地和服务器上都接受故障
Where I got the error: wp管理/自定义。php
Code in function.php file:
if(!is_admin()){
add_filter( \'wp_get_nav_menu_items\', \'display_lasts_ten_posts_for_categories_menu_item\', 10, 3 );
}
function display_lasts_ten_posts_for_categories_menu_item( $items, $menu, $args ) {
if ( is_admin() ) {
return $items;
}
$menu_order = count($items);
$child_items = array();
foreach ( $items as $item ) {
if ( \'category\' != $item->object || (\'category\' == $item->object && get_category_children($item->object_id)) )
continue;
$category_ten_last_posts = array(
\'numberposts\' => 4,
\'cat\' => $item->object_id,
\'orderby\' => \'date\',
\'order\' => \'DESC\'
);
foreach ( get_posts( $category_ten_last_posts ) as $post ) {
$post->menu_item_parent = $item->ID;
$post->post_type = \'nav_menu_item\';
$post->object = \'header-lasts\';
$post->type = \'header-lasts\';
$post->menu_order = ++$menu_order;
$post->title = get_the_post_thumbnail( $post->ID ) . \' \' .$post->post_title;
$post->url = get_permalink( $post->ID );
$child_items[]= $post;
}
}
return array_merge( $items, $child_items );
}