web-dev-qa-db-fra.com

"Aucune page trouvée" dans le tableau de bord après l'enregistrement de la taxonomie personnalisée

Pour une raison quelconque, aucune de mes pages n'apparaît dans le tableau de bord après l'ajout d'une taxonomie personnalisée pour un type de publication personnalisé que j'ai.

Cela se produit uniquement avec Pages. Les messages, les types de messages personnalisés, ils sont tous bien là.

Vous trouverez ci-dessous le code que j'ai utilisé pour le CPT et la taxonomie personnalisée.

CPT career

function career_post_type() {

    $labels = array(
        'name'                  => _x( 'Careers', 'Post Type General Name', 'text_domain' ),
        'singular_name'         => _x( 'Career', 'Post Type Singular Name', 'text_domain' ),
        'menu_name'             => __( 'Careers', 'text_domain' ),
        'name_admin_bar'        => __( 'Career', 'text_domain' ),
        'archives'              => __( 'Career Archives', 'text_domain' ),
        'parent_item_colon'     => __( 'Parent Career:', 'text_domain' ),
        'all_items'             => __( 'All Careers', 'text_domain' ),
        'add_new_item'          => __( 'Add New Career', 'text_domain' ),
        'add_new'               => __( 'Add New', 'text_domain' ),
        'new_item'              => __( 'New Career', 'text_domain' ),
        'edit_item'             => __( 'Edit Career', 'text_domain' ),
        'update_item'           => __( 'Update Career', 'text_domain' ),
        'view_item'             => __( 'View Career', 'text_domain' ),
        'search_items'          => __( 'Search Career', 'text_domain' ),
        'not_found'             => __( 'Not found', 'text_domain' ),
        'not_found_in_trash'    => __( 'Not found in Trash', 'text_domain' ),
        'featured_image'        => __( 'Featured Image', 'text_domain' ),
        'set_featured_image'    => __( 'Set featured image', 'text_domain' ),
        'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
        'use_featured_image'    => __( 'Use as featured image', 'text_domain' ),
        'insert_into_item'      => __( 'Insert into career', 'text_domain' ),
        'uploaded_to_this_item' => __( 'Uploaded to this career', 'text_domain' ),
        'items_list'            => __( 'Careers list', 'text_domain' ),
        'items_list_navigation' => __( 'Careers list navigation', 'text_domain' ),
        'filter_items_list'     => __( 'Filter careers list', 'text_domain' ),
    );
    $args = array(
        'label'                 => __( 'Career', 'text_domain' ),
        'description'           => __( 'Fields of career', 'text_domain' ),
        'labels'                => $labels,
        'supports'              => array( 'title', 'editor', 'excerpt', 'thumbnail', 'trackbacks', 'revisions', ),
        'taxonomies'            => array( 'post_tag' ),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-nametag',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'capability_type'       => 'post',
    );
    register_post_type( 'career', $args );
}

Taxonomie personnalisée fields

if ( ! function_exists( 'create_fields_taxonomy' ) ) {

    function create_fields_taxonomy() {

        $labels = array(
            'name'                       => _x( 'Fields', 'Taxonomy General Name', 'text_domain' ),
            'singular_name'              => _x( 'Field', 'Taxonomy Singular Name', 'text_domain' ),
            'menu_name'                  => __( 'Field', 'text_domain' ),
            'all_items'                  => __( 'All Items', 'text_domain' ),
            'parent_item'                => __( 'Parent Item', 'text_domain' ),
            'parent_item_colon'          => __( 'Parent Item:', 'text_domain' ),
            'new_item_name'              => __( 'New Item Name', 'text_domain' ),
            'add_new_item'               => __( 'Add New Item', 'text_domain' ),
            'edit_item'                  => __( 'Edit Item', 'text_domain' ),
            'update_item'                => __( 'Update Item', 'text_domain' ),
            'view_item'                  => __( 'View Item', 'text_domain' ),
            'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
            'add_or_remove_items'        => __( 'Add or remove items', 'text_domain' ),
            'choose_from_most_used'      => __( 'Choose from the most used', 'text_domain' ),
            'popular_items'              => __( 'Popular Items', 'text_domain' ),
            'search_items'               => __( 'Search Items', 'text_domain' ),
            'not_found'                  => __( 'Not Found', 'text_domain' ),
            'no_terms'                   => __( 'No items', 'text_domain' ),
            'items_list'                 => __( 'Items list', 'text_domain' ),
            'items_list_navigation'      => __( 'Items list navigation', 'text_domain' ),
        );
        $args = array(
            'labels'                     => $labels,
            'hierarchical'               => true,
            'public'                     => true,
            'show_ui'                    => true,
            'show_admin_column'          => true,
            'show_in_nav_menus'          => true,
            'show_tagcloud'              => true,
        );
        register_taxonomy( 'fields', array( 'career' ), $args );

    }
    add_action( 'init', 'create_fields_taxonomy', 0 );

}

Lorsque j'essaie de supprimer le bloc de code de la taxonomie personnalisée fields, les pages reviennent et sont répertoriées dans le tableau de bord. Je suis donc presque sûr que c'est la taxonomie personnalisée qui est le code incriminé. Seulement que je suis perplexe quant à pourquoi.

Juste un FYI. J'ai parcouru mes plugins. Je les ai même tous supprimés juste pour le plaisir. Pas de joie.

3
jeffimperial

fields est utilisé en interne par WordPress et ne peut pas être enregistré en tant que taxonomie ou type de message. Consultez la liste des termes réservés sur la page Codex register_taxonomy pour plus d’informations.

4
Milo