다음 코드를 사용하여 사용자 지정 분류를 만들었습니다. 모든 것이 거의 완벽하게 작동하며 이것이 만들어졌습니다. 관리자 사이드 메뉴와 기사 목록 페이지의 퀵 에디션에서 사용할 수 있습니다. 그러나 "게시물 편집"관리 페이지에는 없습니다 (카테고리 및 태그 관련) :
add_action( 'init', 'create_chapitres_taxo', 0 );
function create_chapitres_taxo() {
$labels = array(
'name' => _x( 'Chapitres', 'taxonomy general name' ),
'singular_name' => _x( 'Chapitre', 'taxonomy singular name' ),
'search_items' => __( 'Recherche un chapitre' ),
'popular_items' => __( 'Capitres populaires' ),
'all_items' => __( 'Toutes les catégories' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Editer la chapitre' ),
'update_item' => __( 'Editer la chapitre' ),
'add_new_item' => __( 'Ajouter un chapitre' ),
'new_item_name' => __( 'Ajouter un chapitre' ),
'separate_items_with_commas' => __( 'Séparer les chapitres avec une virgule' ),
'add_or_remove_items' => __( 'Ajouter ou retirer un chapitre' ),
'choose_from_most_used' => __( 'Choisir le chapitre' ),
'menu_name' => __( 'Chapitres' ),
);
register_taxonomy('chapitre','post',array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'chapitres' ),
));
}
그러나
이 문제를 해결하기 위해 무엇을 시도 할 수 있습니까?
'show_in_rest' => true
Gutemberg 인터페이스에 표시하려면 인수에 :을 추가해야합니다 .
따라서 다음과 같이됩니다.
register_taxonomy('chapitre','post',array(
'hierarchical' => false,
'labels' => $labels,
'show_in_rest' => true //add this
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'chapitres' ),
));
참고 : 클래식 wysiwyg (포스트 편집 페이지)가 아닌 Gutemberg 블록 빌더 인터페이스가 필요한 경우 사용자 정의 포스트 유형을 선언 할 때 동일한 매개 변수를 사용해야합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다