我正在尝试创建一个名为DondeAmigo的自定义post类型,它接受分层页面。示例:我创建了一个名为“lewis”的页面,其URL为: /donde-amigo/lewis。然后,我创建了一个名为“家”的页面,我希望它在“lewis”下面。这样做的目的是让URL成为/donde-amigo/lewis/home。
我将hierarchical设置为true,并在'supports'中添加了'page-attributes'。但是,当我编辑新页面时,我没有看到“添加父页”选项。
//WHERE IS OUR FRIEND?
$labels = array(
'name' => _x( 'DondeAmigo', 'post type general name' ),
'singular_name' => _x( 'dondeamigo', 'post type singular name' ),
'add_new' => _x( 'Añadir nueva', 'book' ),
'add_new_item' => __( 'Añadir nueva página' ),
'edit_item' => __( 'Editar página' ),
'new_item' => __( 'Nueva página' ),
'view_item' => __( 'Ver página' ),
'search_items' => __( 'Buscar página' ),
'not_found' => __( 'No se han encontrado página' ),
'not_found_in_trash' => __( 'No se han encontrado páginas en la papelera' ),
'parent_item_colon' => ''
);
// Creamos un array para $args
$args = array( 'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'taxonomies' => array('dondeamigo'),
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => true,
'menu_position' => null,
'show_in_rest' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields','page-attributes')
);
register_post_type( 'donde-amigo', $args );
发布于 2021-01-10 17:35:22
我发现,如果在编辑页面之前按fast_edit,就可以选择高级页面。如果您访问edit,则不存在此选项。
原因可能是插件之间或插件与WordPress之间的冲突。
https://wordpress.stackexchange.com/questions/381202
复制相似问题