Support

Home Forums Event Espresso Premium Can I add the WP Core Categories Taxonomy to Events?

Can I add the WP Core Categories Taxonomy to Events?

Posted: September 1, 2016 at 4:03 pm


yamamDev

September 1, 2016 at 4:03 pm

Id like to add the WordPress default Categories taxonomy to Event Espresso events. I feel like this should be a default setting, but im not seeing them anywhere. Is this possible?


Josh

  • Support Staff

September 2, 2016 at 1:34 pm

No setting for this. Instead you use a few filter hooks. So first to add the post category taxonomy onto the espresso_events post type, you add the following to your functions file:

add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_add_category_to_event_cpt' );
function ee_add_category_to_event_cpt( $cpt_registry_array ) {
    if ( isset( $cpt_registry_array['espresso_events'] ) ) {
        $cpt_registry_array['espresso_events']['args']['taxonomies'] = array(
            'espresso_event_categories',
            'espresso_event_type',
            'post_tag',
            'category'
        );
    }
    return $cpt_registry_array;
}

Then, to make those events get displayed in the category archives along with the regular WordPress posts, you use a little function like the one posted in CSS tricks:

https://css-tricks.com/snippets/wordpress/make-archives-php-include-custom-post-types/


yamamDev

September 2, 2016 at 3:30 pm

Perfect! worked like a charm. thank you!

The support post ‘Can I add the WP Core Categories Taxonomy to Events?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso