微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Wordpress 5.6.1 自定义帖子类型保存问题,所见即所得

如何解决Wordpress 5.6.1 自定义帖子类型保存问题,所见即所得

我正在使用自定义帖子类型。我不想使用古腾堡,只是一个标题和所见即所得。

当我保存帖子时,一切正常。但是当我切换到一个页面时,我收到这个 javascript 警报“离开站点?,您所做的更改可能无法保存。”即使两个字段都包含内容

在supports数组中注册时只使用标题不会出现这个问题。

注册代码放在插件主题中,使用二十二十一,或使用启用 jQuery Migrate Helper 没有任何区别。

有人可以帮忙吗?

// Register Custom Post Type
function custom_post_type_01() {

    $labels = array(
        'name'                  => _x( 'cpt01','Post Type General Name','redlum_' ),'singular_name'         => _x( 'cpt01','Post Type Singular Name','menu_name'             => __( 'cpt01','name_admin_bar'        => __( 'cpt01','archives'              => __( 'Item Archives','attributes'            => __( 'Item Attributes','parent_item_colon'     => __( 'Parent Item:','all_items'             => __( 'All Items','add_new_item'          => __( 'Add New Item','add_new'               => __( 'Add New','new_item'              => __( 'New Item','edit_item'             => __( 'Edit Item','update_item'           => __( 'Update Item','view_item'             => __( 'View Item','view_items'            => __( 'View Items','search_items'          => __( 'Search Item','not_found'             => __( 'Not found','not_found_in_trash'    => __( 'Not found in Trash','featured_image'        => __( 'Featured Image','set_featured_image'    => __( 'Set featured image','remove_featured_image' => __( 'Remove featured image','use_featured_image'    => __( 'Use as featured image','insert_into_item'      => __( 'Insert into item','uploaded_to_this_item' => __( 'Uploaded to this item','items_list'            => __( 'Items list','items_list_navigation' => __( 'Items list navigation','filter_items_list'     => __( 'Filter items list',);
    $args = array(
        'label'                 => __( 'cpt01','description'           => __( 'cpt01','labels'                => $labels,'supports'              => array( 'title','editor' ),'hierarchical'          => false,'public'                => true,'show_ui'               => true,'show_in_menu'          => true,'menu_position'         => 5,'show_in_admin_bar'     => true,'show_in_nav_menus'     => true,'can_export'            => true,'has_archive'           => false,'exclude_from_search'   => false,'publicly_queryable'    => true,'rewrite'               => false,'capability_type'       => 'page','show_in_rest'          => false,);
    register_post_type( 'cpt01',$args );

}

add_action( 'init','custom_post_type_01',0 );

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。