How can we help?

Attendee limit on registration addon

WP Event Manager Add-ons Tutorial for limit on registration addon

This tutorial shows how to limit on registration of the attendee(Limit on registration).

  1. First add a new field in functions.php and following tutorial Adding a new field for event submission form documentation. If you want to add a field using field editor make the label name registration limit. Once you have added fields you can add below code to your function.php file.
  2. Open up your theme functions.php field.
  3. Create a function to the events section and hook it in:
  4. Add the code:
    * @return boolean 
    function custom_event_registration_form_addon(){
              $event_id = get_the_ID();
              $args = apply_filters( 'event_manager_custom_event_registrations_args', array('post_type' => 'event_registration',
              'post_status' => array_diff( array_merge( array_keys( get_event_registration_statuses() ), array( 'publish' ) ), array( 
              'archived' ) ),'ignore_sticky_posts' => 1,'posts_per_page' => '-1','post_parent' => $event_id
              ) );
             $the_query = new WP_Query( $args );
    //change the 5 to your limitation of attendee
             $registration_limit = get_post_meta($event_id,'_registration_limit',true);
    //_registration_limit is a field name
             if($registration_limit >= 0 && $the_query->found_posts >= $registration_limit ){
    //if you want to show notice then you can keep below line otherwise remove.
            echo '<div class="wpem-alert wpem-alert-warning">The registration for this event is full.</div>';
         return false;
         return true;
Was this article helpful?
How can we improve this article?
How Can We Improve This Article?
Quick Links