Custom Post Type Single Page is not working
I wanted to know, why my single custom post type isn't working.
Everytime I wanted to open the single post type it automatically gets back to the homepage.
Please help!
Here is my code:
// Team im Backend hinzufügen
function register_team() {
$labels = array(
'name' = __( 'Team', 'team' ),
'singular_name' = __( 'Team', 'team' ),
'add_new' = __( 'Neues Mitglied', 'team' ),
'add_new_item' = __( 'Neues Mitglied', 'team' ),
'edit_item' = __( 'Mitglied bearbeiten', 'team' ),
'new_item' = __( 'Neues Mitglied', 'team' ),
'view_item' = __( 'Zeige Mitglied', 'team' ),
'all_items' = 'Alle Mitglieder',
'search_items' = __( 'Suche Mitglied', 'team' ),
'not_found' = __( 'Keine Mitglied gefunden', 'team' ),
'not_found_in_trash' = __( 'Kein Mitglied im Papierkorb gefunden', 'team' ),
'parent_item_colon' = __( 'Übergeordnetes Mitglied:', 'team' ),
'menu_name' = __( 'Team', 'team' ),
'public' = true,
);
$rewrite = array(
'slug' = 'team',
//'slug' = 'portfolio',
'with_front' = true,
'pages' = true,
'feeds' = true,
);
$args = array(
'labels' = $labels,
'supports' = array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'trackbacks', ),
//'taxonomies' = array( 'category' ),
'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' = false,
'has_archive' = true,
'exclude_from_search' = false,
'publicly_queryable' = true,
'rewrite' = $rewrite,
'capability_type' = 'page', 'post'
);
//register_post_type( 'products', $args );
register_post_type( 'team', $args );
}
add_action( 'init', 'register_team' );
// Custom Taxonomie für Team hinzufügen (wie Kategorien)
function add_team_taxonomies() {
register_taxonomy('teamtaxo', 'team', array(
// Hierarchical taxonomy (like categories)
'hierarchical' = true,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' = array(
'name' = _x( 'Team Kategorie', 'taxonomy general name' ),
'singular_name' = _x( 'Team Kategorie', 'taxonomy singular name' ),
'search_items' = __( 'Search Kategorie' ),
'all_items' = __( 'All Kategorie' ),
'parent_item' = __( 'Parent Kategorie' ),
'parent_item_colon' = __( 'Parent Kategorie:' ),
'edit_item' = __( 'Edit Kategorie' ),
'update_item' = __( 'Update Kategorie' ),
'add_new_item' = __( 'Add New Kategorie' ),
'new_item_name' = __( 'New Kategorie Name' ),
'menu_name' = __( 'Team Kategorie' ),
),
// Control the slugs used for this taxonomy
'rewrite' = array(
'slug' = 'team', // This controls the base slug that will display before each term
'with_front' = false, // Don't display the category base before /locations/
'hierarchical' = true // This will allow URL's like /locations/boston/cambridge/
),
));
}
add_action( 'init', 'add_team_taxonomies', 0 );
This is my team category site:
https://test.musikschulegraz.at/team-testseite/
And I can't click on 'mehr lesen...' without getting back to my homepage?
Thank you!
Topic post-type custom-post-types Wordpress
Category Web