fbpx
Participate in our upcoming live webinar on WP Event Manager CRM plugins on 29th May at 10pm IST. Register Now!
How can we help?

Limit the banner Size

An event banner in WP Event Manager plays a pivotal role in attracting your target audience toward your event. It displays your event details and catches the attention of your audience with its exclusive designs and images.

However, to ensure that your website runs smoothly, you need to instruct the event organizers about the banner size as well. This is because too big banner images can affect your website speed. A maximum of 2MB image file can be accepted from everyone.

So how to limit the banner image size? You will learn about the steps in this guide.

Here are the steps that you need to take to limit the event banner size:

  1. Open your child theme function.php.
  2. Add the following code:
    add_filter('event_manager_upload_file_pre_upload', 'wpem_event_manager_upload_file_pre_upload', 10, 3);
       function wpem_event_manager_upload_file_pre_upload($file, $args, $allowed_mime_types)
        {
            if(!empty($file))
            {
                if(isset($file['size']) && $file['size'] > 400000 )
                {
                    return new WP_Error( 'validation-error', __( 'Event banner size no more than 400kb.', 'wp-event-manager' ) );
                }
            }
    
            return $file;
        }
    
Limit The Banner Size
Ashok Dudhat

Our team constantly explores ways that technology can help us reinvent industries. We want to change the world by creating great products that transform industries. We Dream It, We Make It.

Quick Links
Close
Close