admin notice on Insert Media popup screen

I’m unaware of any hooks that tap in in the pop up, but there might be. If not, you could use some jQuery to put your message on the pop-up when Add Media is clicked. I was able to with the following: add_action(‘admin_head’,’myplugin_add_media_popup_notice’); function myplugin_add_media_popup_notice() { ?> <script> jQuery(window).load(function() { // the MEDIA buttons you … Read more

Uploaded image with non-english characters is named incorrectly in upload folder

This is well know issue but for some reason it is not resolved since 2013 https://core.trac.wordpress.org/ticket/22363 You can always sanitized filename by yourself using sanitize_file_name filter. /** * Sanitize filename to not brake links with UTF-8 characters * * WordPress allow to upload files with names containing UTF-8 characters. Some * browsers do not handle … Read more

Populate a custom attachment metadata field with data from the image’s EXIF data?

You can hook into the add_attachment and edit_attachment action hooks and use PHP’s exif_read_data() to add the EXIF data to your attachment’s metadata: <?php add_action( ‘add_attachment’, ‘wpse302908_add_exif’ ); add_action( ‘edit_attachment’, ‘wpse302908_add_exif’ ); /** * Inserts metadata from an image’s EXIF data. * * @param int $post_id The attachment’s post ID. * @return void */ function … Read more

What functions of WP_Filesystem allow me to create a file with code-generated contents in a directory?

Seems like you have several misconceptions/misunderstanding about when/why and how you should write to files. In general never write to any directory in which code resides, either core code or themes and plugins code. Those directories might be shared between different wordpress instances, and therefor they are not appropriate to be used for data related … Read more