• Resolved TA003

    (@ta003)


    Hi,

    I’m trying to register a custom post type with a custom taxonomy.
    The custom post type works fines, but the taxonomy not. When I add a taxanomy I get an error with:

    Taxonomy name
    Taxonomy name0]]> Taxonomy name
    Taxonomy name0]]>

    If I refresh the taxanomy is added. When I select a taxanomy on my custom post type and publish or update the page I get a Blanc screen.

    Any ideas, wath I’m doing wrong?
    Here is my code:

    function locatie_int() {
    	$labels = array(
    		'name' => _x('Locatie', 'post type general name'),
    		'singular_name' => _x('Locatie', 'post type singular name'),
    		'add_new' => _x('Nieuwe locatie', 'locatie'),
    		'add_new_item' => __('Nieuwe locatie'),
    		'edit_item' => __('Locatie bewerken'),
    		'new_item' => __('Nieuwe locatie'),
    		'view_item' => __('Locatie bekijken'),
    		'search_items' => __('Locatie zoeken'),
    		'not_found' =>  __('Geen locatie gevonden'),
    		'not_found_in_trash' => __('Geen locatie gevonden in de prullenbak'),
    		'menu_name' => __( 'Locaties', 'locatie' ),
    		'parent_item_colon' => ''
    	);
    
    	$args = array(
    		'labels' => $labels,
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'query_var' => true,
    		'rewrite' => array( 'slug' => 'locatie'),
    		'capability_type' => 'page',
    		'hierarchical' => false,
    		'menu_position' => 5,
    		'supports' => array('title','editor')
    	);
    
    	register_post_type('locatie',$args);
    
    }
    add_action('init', 'locatie_int');
    
    function locatie_custom_taxonomy() {
       register_taxonomy(
    		'Gemeenten',
    		'locatie',
    		array(
    			'hierarchical' => true,
    			'label' => 'Gemeenten',
    			'query_var' => true,
    			'rewrite' => array('slug' => 'gemeenten','with_front' => false)
    		)
    	); 
    
    }
    add_action( 'init', 'locatie_custom_taxonomy');
  • The topic ‘Custom post type with custom taxonomy’ is closed to new replies.