Regenerate thumbnails after upload

Adding $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $attach_data ); after $attach_id = wp_insert_attachment( $attachment, $filename); Fixed it.

Upload files to wp-content/uploads – What to add in DB?

There is media_handle_sideload() function in core meant for processing files not uploaded through media interface. It’s not exactly what you need since it assumes file is outside of uploads and needs to be moved there as part of process, but it should give you and idea on generating and inserting it as valid attachment.

frontend upload return async-ajax.php 302

If you are using custom front-end registration through wp_signon function, check, if the second parameter, passed to that function is true: $user_signon = wp_signon( $info, true ); ). The second parameter tells WordPress to set the secure cookie for login. It works fine with SSL.

Disable gallery in 3.5 media iframe

You can disable tabs using a filter hook. Replace wpse_76095_isOurMediaUpload() with however you determine that you’re running the media popup. add_filter(‘media_upload_tabs’, ‘wpse_76095_filterMediaUploadTabs’); /** * filter out unwanted media upload tabs * @param array $tabs * @return array */ function wpse_76095_filterMediaUploadTabs($tabs) { if (wpse_76095_isOurMediaUpload()) { unset( $tabs[‘type_url’], // no linking from external sites (no local image) …

Read more

Any way to define WP_UPLOADS_URL (like WP_CONTENT_URL)?

Since version 3.5 you can define constant ‘UPLOADS’ like: define(‘UPLOADS’,’myfiles’); where ‘myfiles’ is a folder location relative to ABSPATH. If the folder does not exist, it will be automatically created. EDIT: It will only work, if a new folder is located below website’s Document Root folder ( ABSPATH ). To put it outside of ABSPATH …

Read more