Support

Home Forums Event Espresso Premium ACF field on Event Category

ACF field on Event Category

Posted: October 10, 2016 at 11:23 am


dave3011

October 10, 2016 at 11:23 am

Hi there,

I’d like to add some ACF fields to event categories. After adding fields in the ACF plugin and choosing ‘espresso_event_categories’ as the taxonomy where the desired fields should be displayed, none of these fields appear when editing a category.

Any idea? Thanks in advance!


Josh

  • Support Staff

October 10, 2016 at 12:28 pm

Hi Dave,

The event category edit page in EE4 is actually a custom route. You can find the native routes (which should have anything added by ACF) by going to
{yoursite.com}/wp-admin/edit-tags.php?taxonomy=espresso_event_categories


dave3011

October 11, 2016 at 12:32 am

Hey Josh,

perfect, thanks a lot, that works! What would be the best way to integrate the link to the native route in the backend (instead of the custom route)? Would like to avoid confusion for the editors.

Thanks!
David


dave3011

October 11, 2016 at 12:32 am

Hey Josh,

perfect, thanks a lot, that works and helps me a lot! What would be the best way to integrate the link to the native route in the backend (instead of the custom route)? Would like to avoid confusion for the editors.

Thanks!
David


Josh

  • Support Staff

October 11, 2016 at 11:14 am

Hi David,

Your best bet is set up a redirect like this:

add_action( 'admin_init', 'ee_event_category_admin_redirects' );
function ee_event_category_admin_redirects() {
    global $pagenow;
    if( $pagenow == 'admin.php' && 
        isset($_GET['page']) && 
        $_GET['page'] == 'espresso_events' && 
        isset($_GET['action']) && 
        $_GET['action'] == 'category_list' 
    ) {
        wp_redirect( admin_url( '/edit-tags.php?taxonomy=espresso_event_categories&post_type=espresso_events' ) );
        exit;
    }
}

You can add the above to a functions plugin or into your WordPress theme’s functions.php file.


dave3011

October 11, 2016 at 11:42 am

Works like a charm, thank you very much Josh!

The support post ‘ACF field on Event Category’ 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