WordPress.org

Make WordPress Core

Ticket #19643: accept_array_fields.diff

File accept_array_fields.diff, 762 bytes (added by griffinjt, 3 years ago)

allow array of data to be passed through $extra_fields

  • wp-admin/includes/file.php

     
    10651065 
    10661066<?php 
    10671067foreach ( (array) $extra_fields as $field ) { 
    1068         if ( isset( $_POST[ $field ] ) ) 
     1068        if ( is_array( $_POST[ $field ] ) ) { 
     1069                foreach ( $_POST[ $field ] as $array_map ) 
     1070                        echo '<input type="hidden" name="' . esc_attr( $field ) . '[]" value="' . esc_attr( stripslashes_deep( $array_map ) ) . '" />'; 
     1071 
     1072        } 
     1073        elseif ( isset( $_POST[ $field ] ) ) 
    10691074                echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( stripslashes( $_POST[ $field ] ) ) . '" />'; 
    10701075} 
    10711076submit_button( __( 'Proceed' ), 'button', 'upgrade' );