Atenção!

Este artigo contém código PHP e destina-se a desenvolvedores. Oferecemos este código como uma cortesia, mas não fornecemos suporte para personalizações de código ou desenvolvimento de terceiros.

Para orientação extra, consulte o tutorial do WPBeginner sobre como adicionar código personalizado.

Dispensar

Descrição

The wpforms_upload_root filter is used to define the directory on the server where files uploaded through WPForms are stored.

Parâmetros

$wpforms_upload_root
(string) URL used for the default path of storing files uploaded through WPForms.

Fonte

wpforms/includes/functions/filesystem-media.php

Mais Informações

The wpforms_upload_root filter can be used to define where the files uploaded through WPForms are stored.

Exemplo

/**
 * Change the path where file uploads are stored in WPForms.
 *
 * @link    https://wpforms.com/developers/wpforms_upload_root/
 *
 * @param   string  $wpforms_upload_root  root path of where file uploads will be stored.
 * @return  string
 */

function wpf_dev_upload_root( $wpforms_upload_root ) {
 
    //Define the path for your file uploads here
    $wpforms_upload_root = '/home/mysitedomain/public_html/custom-dir';  
        
    return $wpforms_upload_root;
       
}
add_filter( 'wpforms_upload_root', 'wpf_dev_upload_root', 10, 1 );

This change will change the location of where the files are stored. This will not update the email notification URL.

Article Reference: How to Define a Specific Directory For File Uploads