Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tribe_revision_support_me() {
- add_post_type_support( 'tribe_events', 'revisions' );
- }
- add_action('init', 'tribe_revision_support_me', 0);
- function mrw_tag_imported_events( $post_id, $post ) {
- // stop if args aren't set or we're not dealing with an event
- if (! ( isset($postId) && isset($post->post_type) ) && ! get_post_type($post_id) == 'tribe_events') {
- return;
- }
- // get the field Tribe sets for event source
- $mrw_event_origin = get_post_meta( $post_id, '_EventOrigin', true );
- // if source is facebook and this isn't a revision, set a category for the post
- if( $mrw_event_origin == 'facebook-importer' && !wp_is_post_revision( $post_id ) ) {
- // echo "<h1>mrw_event_origin</h1>: " . $mrw_event_origin . " - revision: " . var_export(wp_is_post_revision($post_id), true) . " - post_id: " . $post_id; die();
- // set category to 'community events'
- // wp_set_object_terms( $post_id, 340, 'tribe_events_cat', true );
- }
- }
- add_action( 'wp_insert_post', 'mrw_tag_imported_events', 11, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement