Custom Post Type with rewrite slug
-
Hello,
i created a Custom Post Type “publication”, and i can view the items under mysite.com/publication/. But i need to view this items under mysite.com/veroeffentlichungen/, so i use the rewrite-attribute in my Custom Post Type, but i get an 404 when i access mysite.com/veroeffentlichungen/. I have resaved the Permalink-Setting already.
<?php // Register Custom Post Type function publication_post_type() { $labels = array( 'name' => _x( 'Ver?ffentlichungen', 'Post Type General Name', 'text_domain' ), 'singular_name' => _x( 'Ver?ffentlichung', 'Post Type Singular Name', 'text_domain' ), 'menu_name' => __( 'Ver?ffentlich.', 'text_domain' ), 'parent_item_colon' => __( 'Parent Product:', 'text_domain' ), 'all_items' => __( 'Alle Ver?ffentlichungen', 'text_domain' ), 'view_item' => __( 'Ver?ffentlichungen ansehen', 'text_domain' ), 'add_new_item' => __( 'Neue Ver?ffentlichung', 'text_domain' ), 'add_new' => __( 'Ver?ffentlichung hinzufügen', 'text_domain' ), 'edit_item' => __( 'Ver?ffentlichung bearbeiten', 'text_domain' ), 'update_item' => __( 'Ver?ffentlichung aktualisieren', 'text_domain' ), 'search_items' => __( 'Ver?ffentlichung suchen', 'text_domain' ), 'not_found' => __( 'keine Ver?ffentlichung gefunden', 'text_domain' ), 'not_found_in_trash' => __( 'keine Ver?ffentlichungen im Papierkorb gefunden', 'text_domain' ), ); $rewrite = array( 'slug' => 'veroeffentlichungen', 'with_front' => false, 'pages' => true, 'feeds' => false, ); $args = array( 'label' => __( 'publication', 'text_domain' ), 'description' => __( 'Ver?ffentlichungen', 'text_domain' ), 'labels' => $labels, 'supports' => array( 'title', ), 'taxonomies' => array( 'category', 'post_tag' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'post', ); register_post_type( 'publication', $args ); } // Hook into the 'init' action add_action( 'init', 'publication_post_type', 0 );
What am i doing wrong?
Thanks a lot.
Andy
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom Post Type with rewrite slug’ is closed to new replies.