• Resolved MatrixMedia

    (@matrixmedia)


    Hi, I tried to disable auto-deletion of uploaded files, like this:

    function mtx_remove_action_auto_delete_files() {
    	remove_action( 'template_redirect', 'dnd_cf7_auto_clean_dir', 30);
    }
    add_action('plugins_loaded', 'mtx_remove_action_auto_delete_files', 30, 1);

    but, the files are still deleted …
    … where am I wrong?
    is it the fault of cf7?

    Thank
    Regards

    • This topic was modified 3 years, 5 months ago by MatrixMedia.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Glen Don Mongaya

    (@glenwpcoder)

    @matrixmedia , try this filter.

    add_filter('dnd_cf7_auto_delete_files', 'cf7_adjust_auto_file_deletion');
    function cf7_adjust_auto_file_deletion( $time ){
          $time = 31536000;
          return $time;
    }

    31536000 = is equivalent to 1 year, you can adjust/change that according to your preference.

    I think there’s a problem with ‘plugins_loaded’ hook which cannot remove existing action with my plugin.

    Thread Starter MatrixMedia

    (@matrixmedia)

    Hi Glen,
    thanks for the assistance, now everything works!

    Regards

    add_filter('dnd_cf7_auto_delete_files', 'cf7_adjust_auto_file_deletion');
    function cf7_adjust_auto_file_deletion( $time ){
          $time = 31536000;
          return $time;
    }

    unfortunately this code does not work
    the file is deleted from the temporary folder, and the folder itself is the same
    does not affect and change the date by more (seconds)
    latest WP version 5.7.2
    are there any alternatives?
    or do I need to add add_action and add_filter together?

    • This reply was modified 3 years, 4 months ago by Sergiy.
    • This reply was modified 3 years, 4 months ago by Sergiy.
    Plugin Author Glen Don Mongaya

    (@glenwpcoder)

    Hello @se8pro ,

    Please create another topic here – https://www.ads-software.com/support/plugin/drag-and-drop-multiple-file-upload-contact-form-7/#new-topic-0

    This thread has been closed.

    Thanks,
    Glen

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Disable Auto Delete’ is closed to new replies.