Formidable Forms disable image thumbnail generation



By default, when you upload an image on any Formidable Forms form during post creation, the image is uploaded to the wp-content/uploads/formidable/1 folder and generates all thumbnail images that register on your WordPress website. However, you might not need any thumbnails if the main image is used only for sending admin email notifications or for another specific purpose. Thus, you can stop generating thumbnails to save some disk space.

Formidable Forms disable image thumbnail generation

To stop generating the thumbnail images or delete them all, we can use the frm_after_create_entry hook, which runs after a form is submitted and an entry is created. You can find more details here:

Now, we can utilize the PHP glob() function to verify whether the wp-content/uploads/formidable/1 directory contains any image thumbnails or scaled versions that have been created. Subsequently, we can employ the PHP unlink() function to remove these generated images.

PHP functions reference:


The Formidable Forms save all post (creation) images in wp-content/uploads/formidable/2, but form upload media is saved in wp-content/uploads/formidable/1. So, if you add 1 after the /formidable/ on the fourth line, it will only apply the code to the 1 folder and allow thumbnails of the post images.

function after_entry_created( $entry_id, $form_id )
 $upload_dir  = wp_upload_dir();
 $upload_path = $upload_dir[ 'basedir' ] . '/formidable/1';

 // Patterns to match thumbnails
 $thumbnails_pattern = $upload_path . '**/{*-*x*.*,*-scaled.*}';

 $thumbnails = glob( $thumbnails_pattern, GLOB_BRACE );

 // Delete all thumbnails
 foreach ( $thumbnails as $thumbnail ) {
  if ( is_writable( $thumbnail ) ) {
   unlink( $thumbnail );

add_action( 'frm_after_create_entry', 'after_entry_created', 50, 2 );

You can use the above code snippet in your child theme’s functions.php file or use a Code Snippets plugin.

Code Snippets plugin settings:

Formidable Forms disable image thumbnail generation


Formidable Forms disable image thumbnail generation

Note: Keep in mind that this function will delete all image thumbnails and scaled copies from Formidable Forms folder. Make sure to back up your website before using this code snippet. To make a backup, have a look here:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.