WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy page 404 (2 posts)

  1. iSneaker
    Member
    Posted 1 year ago #

    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 http://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 http://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' ),
    	  ));
    
    	}
  2. iSneaker
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags