Multi-Site wp_handle_upload bug?
-
I’m working on plugin, which should allow front-end picture-updates.
I ran into two problems, which might be a bug (perhaps some thoughts i didn’t consider). If you use wp_handle_upload and wp_insert_attachment you have to add guid in the attachment array, otherwise it’s not added (#1). Unfortunately if you use the array returned from wp_handle_upload, the url points to mu-blogurl . /files/ etc.
This is alright if you haven’t been messing with the .htacess but if you using e.g. user-access-manager plugin it doesn’t work.For me I solved this with the following code:
if(is_multisite()) { $corrected = ""; $corrected .= substr($file_return['url'], 0, strpos($file_return['url'], "/files/")); $corrected .= substr($file_return['file'], strpos($file_return['file'], "/wp-content/")); // return array form wp_handle_upload $file_return['url'] = $corrected; }
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘Multi-Site wp_handle_upload bug?’ is closed to new replies.