Permalinks für Taxonomie und benutzerdefinierte Beitragstyp

Habe folgende Situation hier:

Benutzerdefinierter Beitragstyp: ‘Rezepte’
Taxonomie für benutzerdefinierte Post-Typ ‘Rezepte’: ‘Receitas’
Eine der Taxonomien Slug: “Receitas-Whoopie-Pie”

Die Permalink-Struktur muss sein:

example.com/receitas (zeige alle Posts von benutzerdefinierten Post-Typ ‘Rezepte’ … es kann bei Bedarf eine Seitenvorlage sein)
example.com/receitas-whoopie-pie (Zeige alle Posts von benutzerdefinierten Post-Typ ‘Rezepte’ unter der Taxonomie ‘recipescat’ -> ‘receitas-whoopie-pie’)
example.com/receitas-whoopie-pie/post_name (zeige einen einzelnen Beitrag unter der Taxonomie ‘receitas’ -> ‘receitas-whoopie-pie’)

Ich habe versucht, viele Möglichkeiten, dies durch Filter, die einzige, die funktioniert, geben Sie mir eine 404-Seite beim Zugriff auf die … / receitas-whoopie-pie / post_name.

Eigentlich habe ich folgende Struktur:

Meine functionen unabhängig von diesem Problem:
example.com/receitas (zeige alle Posts von benutzerdefinierten Post-Typ ‘Rezepte’ – Seitenvorlage)
example.com/receitas/receitas-whoopie-pie (Zeige alle Posts von benutzerdefinierten Post-Typ ‘Rezepte’ unter der Taxonomie ‘recipescat’ -> ‘receitas-whoopie-pie’)
example.com/recipes/post_name (zeige einen einzelnen Beitrag unter der Taxonomie ‘receitas’ -> ‘receitas-whoopie-pie’)

add_action( 'init', 'receitas_posttype', 0 ); function receitas_posttype() { $labels = array( 'menu_name' => 'Receitas', 'name' => 'Receitas', 'singular_name' => 'Receita', 'parent_item_colon' => '', 'all_items' => 'Todas as Receitas', 'view_item' => 'Ver Receita', 'add_new_item' => 'Adicionar Receita', 'add_new' => 'Nova Receita', 'edit_item' => 'Editar Receita', 'update_item' => 'Atualizar Receita', 'search_items' => 'Pesquisar Receita', 'not_found' => 'Receita(s) não encontrada(s)', 'not_found_in_trash' => 'Receita(s) não encontrada(s) no lixo' ); $args = array( 'label' => 'recipes', 'description' => 'Receitas', 'labels' => $labels, 'supports' => array( 'title', 'editor', 'author', 'thumbnail' ), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 100, 'menu_icon' => get_bloginfo('stylesheet_directory').'/images/receitas.png', 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'post', ); register_post_type( 'recipes', $args ); } add_action( 'init', 'receitascat', 0 ); function receitascat() { $labels = array( 'name' => _x( 'Receitas', 'Taxonomy General Name', 'ickfd' ), 'singular_name' => _x( 'Receita', 'Taxonomy Singular Name', 'ickfd' ), 'menu_name' => __( 'Categorias de Receita', 'ickfd' ), 'all_items' => __( 'Todas as categorias', 'ickfd' ), 'parent_item' => __( 'Categoria pai', 'ickfd' ), 'parent_item_colon' => __( 'Categoria pai:', 'ickfd' ), 'new_item_name' => __( 'Nova categoria', 'ickfd' ), 'add_new_item' => __( 'Adicionar nova categoria', 'ickfd' ), 'edit_item' => __( 'Editar categoria', 'ickfd' ), 'update_item' => __( 'Atualizar categoria', 'ickfd' ), 'separate_items_with_commas' => __( 'Separe as categorias com vírgula', 'ickfd' ), 'search_items' => __( 'Pesquisar categorias', 'ickfd' ), 'add_or_remove_items' => __( 'Adicionar ou remover categorias', 'ickfd' ), 'choose_from_most_used' => __( 'Escolha as categorias mais usadas', 'ickfd' ), ); $rewrite = array( 'slug' => 'receitas', 'with_front' => true, 'hierarchical' => true, ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false, 'rewrite' => $rewrite, ); register_taxonomy( 'receitas', 'recipes', $args ); } 

Die functionen, die ARBEITSWEISE, aber mit 404-Seite in der singulären Seite:

 add_action( 'init', 'receitas_posttype', 0 ); function receitas_posttype() { $labels = array( 'menu_name' => 'Receitas', 'name' => 'Receitas', 'singular_name' => 'Receita', 'parent_item_colon' => '', 'all_items' => 'Todas as Receitas', 'view_item' => 'Ver Receita', 'add_new_item' => 'Adicionar Receita', 'add_new' => 'Nova Receita', 'edit_item' => 'Editar Receita', 'update_item' => 'Atualizar Receita', 'search_items' => 'Pesquisar Receita', 'not_found' => 'Receita(s) não encontrada(s)', 'not_found_in_trash' => 'Receita(s) não encontrada(s) no lixo' ); $args = array( 'label' => 'recipes', 'description' => 'Receitas', 'labels' => $labels, 'supports' => array( 'title', 'editor', 'author', 'thumbnail' ), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 100, 'menu_icon' => get_bloginfo('stylesheet_directory').'/images/receitas.png', 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'rewrite' => true, 'capability_type' => 'post', ); register_post_type( 'recipes', $args ); } // Ativação das categorias (taxonomias) do custom post type add_action( 'init', 'receitascat', 0 ); function receitascat() { $labels = array( 'name' => _x( 'Receitas', 'Taxonomy General Name', 'ickfd' ), 'singular_name' => _x( 'Receita', 'Taxonomy Singular Name', 'ickfd' ), 'menu_name' => __( 'Categorias de Receita', 'ickfd' ), 'all_items' => __( 'Todas as categorias', 'ickfd' ), 'parent_item' => __( 'Categoria pai', 'ickfd' ), 'parent_item_colon' => __( 'Categoria pai:', 'ickfd' ), 'new_item_name' => __( 'Nova categoria', 'ickfd' ), 'add_new_item' => __( 'Adicionar nova categoria', 'ickfd' ), 'edit_item' => __( 'Editar categoria', 'ickfd' ), 'update_item' => __( 'Atualizar categoria', 'ickfd' ), 'separate_items_with_commas' => __( 'Separe as categorias com vírgula', 'ickfd' ), 'search_items' => __( 'Pesquisar categorias', 'ickfd' ), 'add_or_remove_items' => __( 'Adicionar ou remover categorias', 'ickfd' ), 'choose_from_most_used' => __( 'Escolha as categorias mais usadas', 'ickfd' ), ); $rewrite = array( 'slug' => '', 'with_front' => false, 'hierarchical' => true, ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false, 'rewrite' => $rewrite, ); register_taxonomy( 'receitas', 'recipes', $args ); } function filter_post_type_link($link, $post) { if ($post->post_type != 'recipes') return $link; if ($cats = get_the_terms($post->ID, 'receitas')) $link = str_replace('recipes', array_pop($cats)->slug, $link); return $link; } add_filter('post_type_link', 'filter_post_type_link', 10, 2); 

Danke im Voraus. Entschuldigung für mein schlechtes Englisch. 🙁

Solutions Collecting From Web of "Permalinks für Taxonomie und benutzerdefinierte Beitragstyp"