Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter stampdoor

    (@stampdoor)

    Thank you for your reply.

    I followed your advice and added a process for when the file field is empty and it works as desired.

    add_filter('cf7_2_post_metafield_file', 'change_meta_field_file_format', 10, 6);
    function change_meta_field_file_format( $file_format, $attachment_id, $post_id, $post_field, $form_field, $cf7_key ){
    
    	if ( empty( $_FILES[$form_field]['name'] ) ) {
    		return '';
    	}
    	
        $file_format = $attachment_id . '_' . $form_field;
    
        return $file_format;
    
    }
Viewing 1 replies (of 1 total)