• Hi all,

    I’m busy with a CPT and added a taxonomy.

    The name of my CPT is “projecten” and the name of my taxonomy is “landen”.

    So if i go to https://mywebsite/projecten I get a archive page. I added a new archive file archive-projecten.php.

    So far, so good.

    But when I go to my taxonomy page https://mywebsite/landen I get a 404 page. I created taxonomy-landen.php but nothing seems to work.

    I flushed my permalink settings but no effect.

    So now I was hoping somebody could help me out.

    add_action('init', 'project_custom_init');  
    
    	/*-- Custom Post Init Begin --*/
    	function project_custom_init()
    	{
    	  $labels = array(
    		'name' => __( 'Projecten','structure'),
    		'singular_name' => __( 'Project','structure' ),
    		'add_new' => __('Voeg toe','structure'),
    		'add_new_item' => __('Voeg nieuw project toe','structure'),
    		'edit_item' => __('Bewerk project','structure'),
    		'new_item' => __('Nieuw project','structure'),
    		'view_item' => __('Bekijk project','structure'),
    	    'all_items' => __('Alle Items'),
    		'search_items' => __('Zoek in projecten','structure'),
    		'not_found' =>  __('Geen projecten gevonden','structure'),
    		'not_found_in_trash' => __('Geen projecten gevonden in de prullenbak','structure'),
    
    	  );
    
    	 $args = array(
    		'labels' => $labels,
    		'public' => true,
    		'exclude_from_search' => false,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'query_var' => true,
    		'capability_type' => 'post',
    		'hierarchical' => true,
    		'menu_position' => null,
    		'supports' => array('title','editor','thumbnail', 'page-attributes','excerpt'),
    	  	'rewrite' => array('hierarchical' => true ),
    		'has_archive' => true,
    
    	  );
    	  // The following is the main step where we register the post.
    	  register_post_type('projecten',$args);
    
    	  // Initialize New Taxonomy Labels
    	  $labels = array(
            'name' => __( 'Landen', 'structure' ),
            'singular_name' => __( 'Landen', 'structure' ),
            'search_items' =>  __( 'Zoek in landen', 'structure' ),
            'popular_items' => __( 'Populaire landen', 'structure' ),
            'all_items' => __( 'Alle landen', 'structure' ),
            'parent_item' => __( 'Hoofd land', 'structure' ),
            'parent_item_colon' => __( 'Hoofd land:', 'structure' ),
            'edit_item' => __( 'Bewerk land', 'structure' ),
            'update_item' => __( 'Update land', 'structure' ),
            'add_new_item' => __( 'Voeg nieuw land toe', 'structure' ),
            'new_item_name' => __( 'Nieuwe naam van land', 'structure' ),
            'separate_items_with_commas' => __( 'Scheid landen met een comma', 'structure' ),
            'add_or_remove_items' => __( 'Add or remove portfolio types', 'structure' ),
            'choose_from_most_used' => __( 'Choose from the most used portfolio types', 'structure' ),
            'menu_name' => __( 'Landen', 'structure' )
    	  );
    		// Custom taxonomy for Project Tags
    		register_taxonomy('landen',array('projecten'), array(
    		'hierarchical' => true,
    		'labels' => $labels,
    		'show_ui' => true,
    		'query_var' => true,
    		'rewrite' => array( 'slug' => 'landen' ),
    	  ));
    
    	}
Viewing 1 replies (of 1 total)
  • Thread Starter iSneaker

    (@isneaker)

    So when I create a category, lets say, “Kenya” the URL is https:// mywebsite/landen/kenya/. This works fine. But what I need is https:// mywebsite/landen/kenya/. I can’t seem to figure that out.

Viewing 1 replies (of 1 total)
  • The topic ‘Taxonomy page 404’ is closed to new replies.