how to add new .webm mime types

The WebM file format isn’t known to WordPress by default, you have to add it. add_filter( ‘upload_mimes’, ‘custom_mimes’ ); function custom_mimes( $mimes ){ $mimes[‘webm’] = ‘video/webm’; return $mimes; } The .ogg file format is known to WordPress as audio/ogg, if you’re wanting to do video with it, the correct extension is .ogv.

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.

How to check if “media_send_to_editor” is audio?

We can simplify the mime type checks, with the following boolean functions: wp_attachment_is( ‘image’, $id ) wp_attachment_is( ‘video’, $id ) wp_attachment_is( ‘audio’, $id ) where $id is the attachment ID. The attachment’s ID is actually one of the input arguments for the media_send_to_editor filter callback. We also have: wp_attachment_is_image( $id ) that’s a wrapper for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)