Media_handle_upload with custom upload folder?

If I’m not mistaken, then it should be possible. You want to use media_handle_upload(), which calls wp_handle_upload() to handle the file upload. wp_handle_upload() on itself won’t be helpful, especially because it is pretty much just a wrapper for _wp_handle_upload(). It’s not the end yet, because inside _wp_handle_upload() the function wp_upload_dir() is called, where we find … Read more

Get full image array

The “full array” is constructed by Advanced Custom Fields from various sources. It’s not a format that occurs natively in WordPress. If you want to output an image tag for an image with all the correct attributes, just use the ID with wp_get_attachment_image(). That returns an HTML <img> tag with the src, width, height, alt, … Read more

Display image file size in media library

In your theme’s functions.php add the following code to get the file size for all of your items in the Media library: add_filter( ‘manage_upload_columns’, ‘wpse_237131_add_column_file_size’ ); add_action( ‘manage_media_custom_column’, ‘wpse_237131_column_file_size’, 10, 2 ); function wpse_237131_add_column_file_size( $columns ) { // Create the column $columns[‘filesize’] = ‘File Size’; return $columns; } function wpse_237131_column_file_size( $column_name, $media_item ) { // … Read more

Display latest 12 images from media library

Simply omit the parent value. $args = array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘published’, ‘numberposts’ => 12, ); Check the documentation for other arguments: Function_Reference/get_posts. Maybe you’d like to use the PHP command shuffle, like shuffle( $attachments );.

Hide upload image fields for the different media upload popups

I’m familiar with attachment_fields_to_edit and don’t recall ever seeing anything on being able to do modification as granular as you’re suggesting. There’s a WP global $screen (or is it $screens) that perhaps might help but I’m not too sure. Have you considered – as hacky as it might sound – doing these things with CSS … Read more