Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a custom post type "Events" and added the categories function for it. However, the categories only shows in the backend CMS which I can set and add new categories, but no message indicating the category that a event was set for in the front end webpage.

How can I make the events categories information shown in the front end webpage?

I have copied the code below:

function enable_event_posttype() {
    register_post_type( 'events',
        array(
            'labels' => array(
                'name' => __( 'Events' ),
                'singular_name' => __( 'Event' ),
                'add_new' => __( 'Add New Event' ),
                'add_new_item' => __( 'Add New Event' ),
                'edit_item' => __( 'Edit Event' ),
                'new_item' => __( 'Add New Event' ),
                'view_item' => __( 'View Event' ),
                'search_items' => __( 'Search Event' ),
                'not_found' => __( 'No events found' ),
                'not_found_in_trash' => __( 'No events found in trash' )
            ),
            'public' => true,

                'supports' => array( 'title', 'editor', 'comments'),
            'capability_type' => 'post',
            'rewrite' => array("slug" => "events"), // Permalinks format
            'menu_icon' => get_bloginfo('stylesheet_directory') . '/images/date.png',  // Icon Path
            'menu_position' => '5'
        )
    );
}

add_action( 'init', 'enable_event_posttype' );



add_action( 'init', 'build_taxonomies', 0 );

function build_taxonomies() {
  register_taxonomy( 'categories', 'events', array( 'hierarchical' => true,  'label' => 'Categories', 'query_var' => true, 'rewrite' => true ) );
}
share|improve this question
add comment

1 Answer

It seems like you got a permalink conflict. You can't give two "things" the same slug/URi in WordPress. Please try it with a different slug than events either for the custom post type or the custom taxonomy.

And yes, I know, this answer will be flagged as "low quality" due to its length.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.