WordPress.org

Forums

Custom Post Types and Custom Taxonomies (2 posts)

  1. tuttle425
    Member
    Posted 5 years ago #

    I have created a custom post type with custom taxonomies. The permalinks for the custom post types work fine. However, I am using custom taxonomies so I can filter the results. The custom post type is "Projects" and the custom taxonomy is "Project Category". Projects can be tagged as commercial, decks, residential, etc.

    I use wp_tag_cloud to list the taxonomies which I hope to use to allow the user to filter the projects. My problem is that I cant get the permalinks for the taxonomies to bring up the projects. They always go to a 404.

    Here is the code for the taxonomy:

    register_taxonomy( 'categories', 'project', array( 'hierarchical' => true, 'label' => __('Project Category'), 'query_var' => true, 'rewrite' => array('slug' => 'projects', 'with_front' => false) ) );

    Here is the code for the custom post type:

    register_post_type('project', array(
      	'label' => __('Projects'),
      	'singular_label' => __('Project'),
      	'public' => true,
      	'show_ui' => true,
    		'_builtin' => false,
      	'capability_type' => 'post',
      	'hierarchical' => false,
      	'rewrite' => array('slug' => 'projects', 'with_front' => false),
      	'query_var' => false,
      	'supports' => array('title', 'editor', 'author', 'category')
    	));

    Any help would be much appreciated.

    Thanks

  2. rofflox
    Member
    Posted 5 years ago #

    Same problem here. Only work-around was to remove the "with_front" setting in the rewrite-param of the register_taxonomy call and set it to the default value.

    Problem now: Ugly permalink structure. *urgh*

Topic Closed

This topic has been closed to new replies.

About this Topic