Пользовательский шаблон таксономии получение 404 - PullRequest
1 голос
/ 16 февраля 2020

У меня есть пользовательская таксономия Publications. Который содержит такие термины, как Marketing, Sales.

. Плагин установлен на /p/. Пример кода:

// Publication Taxonomy

function publication_taxonomy() {
$labels = array(
    'name'                       => _x( 'Publications', 'Taxonomy General Name', 'text_domain' ),
    'singular_name'              => _x( 'Publication', 'Taxonomy Singular Name', 'text_domain' ),
    'menu_name'                  => __( 'Publication', 'text_domain' ),
    'all_items'                  => __( 'All Publications', 'text_domain' ),
    'parent_item'                => __( 'Parent Publication', 'text_domain' ),
    'parent_item_colon'          => __( 'Parent Publication:', 'text_domain' ),
    'new_item_name'              => __( 'New Publication Name', 'text_domain' ),
    'add_new_item'               => __( 'Add New Publication', 'text_domain' ),
    'edit_item'                  => __( 'Edit Publication', 'text_domain' ),
    'update_item'                => __( 'Update Publication', 'text_domain' ),
    'view_item'                  => __( 'View Publication', 'text_domain' ),
    'separate_items_with_commas' => __( 'Separate publication with commas', 'text_domain' ),
    'add_or_remove_items'        => __( 'Add or remove publications', 'text_domain' ),
    'choose_from_most_used'      => __( 'Choose from the most used', 'text_domain' ),
    'popular_items'              => __( 'Popular publications', 'text_domain' ),
    'search_items'               => __( 'Search publication', 'text_domain' ),
    'not_found'                  => __( 'Not Found', 'text_domain' ),
    'no_terms'                   => __( 'No publications', 'text_domain' ),
    'items_list'                 => __( 'Publications list', 'text_domain' ),
    'items_list_navigation'      => __( 'Publications list navigation', 'text_domain' ),
);
$args = array(
    'labels'                     => $labels,
    'hierarchical'               => true,
    'public'                     => true,
    'rewrite'                                    => array( 'slug' => 'p' ),
    'show_ui'                    => true,
    'show_admin_column'          => true,
    'show_in_nav_menus'          => true,
    'show_in_rest'                       => true,
    'show_tagcloud'              => true,
);
register_taxonomy( 'publication', array( 'post','guide' ), $args );

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

Структуры URL работают следующим образом:

  • example.com / p / marketing
  • example.com / p / sales

Те загружают созданный мной шаблон taxonomy-publication.php

Сейчас я пытаюсь создать шаблон, который будет отображаться при посещении example.com/p/, но все, что я получаю, это a 404.

Я попытался обновить настройки постоянной ссылки, но не могу понять, почему /p/ не загружает публикацию таксономии. php. Есть идеи?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...