Last active
February 11, 2024 11:17
-
-
Save rafsuntaskin/529a71d7761312f491757326e85c89d0 to your computer and use it in GitHub Desktop.
Add category to submitted events automatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'tribe_community_event_created', 'rt_ce_auto_add_cat_for_submission' ); | |
function rt_ce_auto_add_cat_for_submission( $event_id ) { | |
$tribe_ecp = Tribe__Events__Main::instance(); | |
// replace with your required category ID. | |
$cat_ids = [ 20 ]; // for multiple values add like this [ 20, 21 ] | |
wp_add_object_terms( $event_id, $cat_ids, $tribe_ecp->get_event_taxonomy() ); | |
} |
Good catch, that one is not needed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rafsuntaskin what is the purpose of line 6?