javascript - How to output when I use wp_handle_upload_prefilter, Wordpress -
simple request, how can find got in $file ? (array ?)
when add print_r or echo, wordpress show me error messeage.
i googled, found nothing, because poor english maybe.
function wp_modify_uploaded_file_names($file) { $info = pathinfo($file['name']); $ext = empty($info['extension']) ? '' : '.' . $info['extension']; $name = basename($file['name'], $ext); $file['name'] = uniqid() . $ext; // uniqid method print_r($file); return $file; } add_filter('wp_handle_upload_prefilter', 'wp_modify_uploaded_file_names', 1, 1);
typically on filters, can't output print_r or echo...or var_dump() in cases. can if want, output end somewhere else expect be.
what use var_export() , set 'return' true , include in return statement of filter.
however, in case of wp_handle_upload_prefilter() if include other formatted $file variable in return statement, you'll error saw.
to see how $file formatted , used, i'd in wp core (specifically /wp-admin/includes/file.php ).
Comments
Post a Comment