Saving Media – Which Hook is Fired?

Actually there are no hook fired after media file(s) upload, at least as far as I know. The problem with the hooks available along the way of uploading and saving media files and data is that they are limited to one portion of the process, and so using any of them is not reliable. For … Read more

How to add a custom field to the media screen (image/gallery)?

Here is the working code (working fine for me), did you tried this? Just add to theme ‘functions.php’ and change the custom field names as needed. //function to add custom media field function custom_media_add_media_custom_field( $form_fields, $post ) { $field_value = get_post_meta( $post->ID, ‘custom_media_style’, true ); $form_fields[‘custom_media_style’] = array( ‘value’ => $field_value ? $field_value : ”, … Read more

Give users a maximum upload capacity; limit the number of files a user can upload OR limit the number of files per upload

Assuming that you’re providing upload functionality via WordPress’ native functions, lik wp_handle_upload or something more high-level, we come to the conclusion that several hooks are going to be pulled. http://core.trac.wordpress.org/browser/tags/3.3/wp-admin/includes/file.php#L212 The wp_handle_upload function would probably be the last native function to touch the file, and would know all the information that is necessary to keep … Read more

Allowing WebP uploads?

It’s necessary to use the wp_check_filetype_and_ext filter to set the mime type and extension for webp files in addition to using the upload_mimes filter to add the mime type to the list of uploadable mimes. /** * Sets the extension and mime type for .webp files. * * @param array $wp_check_filetype_and_ext File data array containing … Read more

how to upload and allow downloads of .mobi and .epub formats

Assuming that you are using the WordPress native Media uploader then you can use the upload_mimes filter hook to add or remove allowed file types, for example: function custom_myme_types($mime_types){ //Adding avi extension $mime_types[‘avi’] = ‘video/avi’; //Removing the pdf extension unset($mime_types[‘pdf’]); return $mime_types; } add_filter(‘upload_mimes’, ‘custom_myme_types’, 1, 1); You can see that to add a file … Read more

How to show all available images in WP’s media library when using the Polylang plugin?

From this post at wordpress.org/support, the user Chrystl points out: If don’t need to translate your media titles, uncheck this option: In Languages > Settings tab > Media: “Activate languages and translations for media”. And you will access to your entire library by clicking on “Add media” and “Set featured image”. And that indeed did … Read more

WordPress Media Uploader events

I don’t think there is. You will have to use some local (browser-based) Javascript code to attach a function to the on-click event of the button. (Not a Javascript expert, but perhaps this will point you in a direction of investigation.)

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