fbpx

How can we help?

Hide/Show registration button on specific events

Not all your events need a Registration Button/ tab. So here is the solution to remove the registrations tab/button in WP Event Manager.

There are certain events where the organizer does not want the people to register for the event and hence does not requires a registration tab.

Hide/Show registration button on specific events

The following code can be implemented in the Functions.php file of the child theme to disable or enable the Registration tab on specific events.

  1. Open your child theme function.php.
  2. Add this code:
    /**
     * registration_limit_restriction
     * @param $method,$post
     * @return $method
     * @since 3.1.11
     */
    function your_child_theme_registration_disable($method,$post){
        $disable_button = get_post_meta($post->ID,'_show_hide_registration_button',true);
        
        //disable button if settings in event meta box
        if( $disable_button == 1){
             return false;
        }else{
            return $method;
        }
    }
    add_filter('display_event_registration_method','your_child_theme_registration_disable',90,2);
    add_filter('get_event_registration_method','your_child_theme_registration_disable',90,2);
     
     
     
     
    add_filter( 'submit_event_form_fields', 'show_hide_registration_button' );
    function show_hide_registration_button( $fields) {  
         
        $fields['event']['show_hide_registration_button'] =  array(
                                            'label'       => __( 'Show Hide Registration Button', 'wp-event-manager-registrations' ),
                                            'type'        => 'checkbox',
                                            'required'    => false,
                                            'priority'    => 22,
                                       );
        return $fields;
    }
    
    

Please see after adding the code, there will be a Enable/disable Registration box on the right hand sidebar.This will help you enable and disable the registration button on the event detail page.

Was this article helpful?
How can we improve this article?
How Can We Improve This Article?
Previous Field restriction on the registration form without sell ticket and attendee information
Next How To Install WP Event Manager Add ons
Quick Links