Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active April 6, 2023 15:36
Show Gist options
  • Save cliffordp/a521d02facbc64ce3891c9341384cc07 to your computer and use it in GitHub Desktop.
Save cliffordp/a521d02facbc64ce3891c9341384cc07 to your computer and use it in GitHub Desktop.
The Events Calendar: Remove the Organizers post type from Events
<?php
/**
* The Events Calendar: Remove the Organizers post type from Events.
*
* Replace instances of ORGANIZER_POST_TYPE with VENUE_POST_TYPE if you
* want to do so for Venues instead.
*
* @link https://theeventscalendar.com/knowledgebase/linked-post-types/
* @link https://gist.github.com/a521d02facbc64ce3891c9341384cc07
*/
function tribe_remove_organizers_from_events( $default_types ) {
if (
! is_array( $default_types )
|| empty( $default_types )
|| empty( Tribe__Events__Main::ORGANIZER_POST_TYPE )
) {
return $default_types;
}
if ( ( $key = array_search( Tribe__Events__Main::ORGANIZER_POST_TYPE, $default_types ) ) !== false ) {
unset( $default_types[ $key ] );
}
return $default_types;
}
add_filter( 'tribe_events_register_default_linked_post_types', 'tribe_remove_organizers_from_events' );
@tannermann
Copy link

This doesn't seem to do anything. Do you happen to have an up-to-date working snippet?

@cliffordp
Copy link
Author

TEC is making a lot of changes right now. I'm not sure in which context this was or is expected to work, but you can link to this if you ask for their help/clarification: https://support.theeventscalendar.com/

@shawfactor
Copy link

wors perfectly for me, brilliant work

@cliffordp
Copy link
Author

Glad to hear @shawfactor - appreciate the info for others

@wise1999
Copy link

This is unfortunately not working right now. I've even tried to use wp function unregister_post_type, which in fact does unregister post type, but the slug is still occupied by this plugin.

@cliffordp
Copy link
Author

@gavin310
Copy link

gavin310 commented Apr 6, 2023

Still works great! Thanks!

@cliffordp
Copy link
Author

@gavin310 glad to know! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment