Setting Categories Field to Required When Submitting an Event

Home Forums Calendar Products Community Events Setting Categories Field to Required When Submitting an Event

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1397284
    Yehuda
    Participant

    Hello,

    I am setting fields in the input screen to required. I followed the instructions here: https://theeventscalendar.com/knowledgebase/required-fields-for-events-submission-form/

    I am not successful in setting the EVENT CATEGORIES field to required. The only reference to Categories that I saw was

    tax_input (for event categories)

    My code:

    add_filter( 'tribe_events_community_required_fields', 'my_community_required_fields', 10, 1 );
    
    function my_community_required_fields( $fields ) {
    
        if ( ! is_array( $fields ) ) {
            return $fields;
        }
    
        $fields[] = 'EventStartDate';
        $fields[] = 'tax_input';
    
        return $fields;
    }

    I was successful setting the Date field.

    Many thanks,
    Yehuda

    #1398447
    Jennifer
    Keymaster

    Hi Yehuda,

    I’m sorry that code isn’t working for you…can you try the following instead and see if it works? I just tested it out on my end, and it does set the category field to required. We are in the process now of updating the knowledge article you referenced with the new code:

    add_filter( 'tribe_events_community_required_fields', 'my_community_required_fields' );
    function my_community_required_fields( $fields ) {
    if ( is_array( $fields ) ) {
    $fields[] = 'tax_input.tribe_events_cat';
    $fields[] = 'EventStartDate';
    }
    return $fields;
    }

    Let me know if that helps!

    Thanks,

    Jennifer

    #1398455
    Yehuda
    Participant

    Hello Jennifer,

    That was it.

    Many thanks!
    Yehuda

    #1398482
    Jennifer
    Keymaster

    Perfect! I’m glad to hear that worked for you. I’ll go ahead and close out this thread, but please feel free to open up a new one if you have any other questions!

    Thanks,

    Jennifer

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Setting Categories Field to Required When Submitting an Event’ is closed to new replies.