Ich habe benutzerdefinierte Post-Typ "Verzeichnis" erstellt und benutzerdefinierte Taxonomie "Verzeichnis-Kategorie" registriert. Es ist jedoch nicht möglich, auf die Taxonomieseite "taxonomy-directory-category.php" zuzugreifen. Der Fehler "Fehler 404 - Nicht gefunden" wird angezeigt.Benutzerdefinierte Taxonomie-Seite funktioniert nicht
function create_post_type_listing() {
register_post_type('directory',
array(
'labels' => array(
'name' => __('Listings'),
'singular_name' => __('Listing'),
'add_new' => __('Add New Listing'),
'add_new_item' => __('Add New Listing'),
'edit' => __('Edit Listing'),
'edit_item' => __('Edit Listing'),
'new_item' => __('New listing'),
'view' => __('View Listing'),
'view_item' => __('View Listing'),
'search_items' => __('Search Listings'),
'not_found' => __('No listings found'),
'not_found_in_trash' => __('No listings found in Trash'),
'featured_image' => __('Listing Image'),
'set_featured_image' => __('Set Listing Image'),
'remove_featured_image' => __('Remove Listing Image'),
'use_featured_image' => __('Use Listing Image')
),
'public' => true,
'menu_position' => 5,
'menu_icon' => plugins_url('images/listing-20x20.png', __FILE__),
'rewrite' => array(
'slug' => __('directory')
),
'supports' => array('title','editor','thumbnail')));
}
add_action('init', 'create_listing_taxonomies', 0);
function create_listing_taxonomies() {
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
'name' => 'Listing Categories',
'singular_name' => 'Listing Category',
'search_items' => 'Listing Categories',
'all_items' => 'All Listing Categories',
'parent_item' => 'Parent Listing Category',
'parent_item_colon' => 'Parent Listing Category:',
'edit_item' => 'Edit Listing Category',
'update_item' => 'Update Listing Category',
'add_new_item' => 'Add New Listing Category',
'new_item_name' => 'New Listing Category',
'menu_name' => 'Listing Category',
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array('slug' => 'directory-category'),
);
register_taxonomy('directory-category', array('directory'), $args);
}
function listing_flush_rules() {
//defines the post type so the rules can be flushed.
create_post_type_listing();
//and flush the rules.
flush_rewrite_rules();
}
register_activation_hook(__FILE__, 'listing_flush_rules');
add_action('init', 'create_post_type_listing');
Bitte helfen Sie mir mit Taxonomie Seitenstruktur.
Grüße, Shubhajeet Saha
groß, dass u Problem bekommen haben. – Shafi