Is it possible to hide media details sidebar when wp.media popup is being opened?

Ok, It’s been so long since I posted this question I totally forgot about it. I finally used popup.on( ‘open’, function() {…}); to remove left modal sidebar. Here we go: popup.on( ‘open’, function() { jQuery( ‘.media-frame-menu’ ).remove(); jQuery( ‘.media-frame-router, .media-frame-title, .media-frame-content, .media-frame-toolbar’ ).css({‘left’: 0}); }); That’s it 🙂 EDIT I managed to hide right hand … Read more

how to get URL of media uploaded to WordPress via media_handle_sideload()

To get the URL of the uploaded image/attachment, you can use wp_get_attachment_url() (which always returns the full-sized image URL) or wp_get_attachment_image_url() for image attachment: // This is how you should call uploadImageToMediaLibrary(); assign the value to $att_id. $att_id = uploadImageToMediaLibrary($post->ID, $external_url, “custom_alt”); $url = wp_get_attachment_image_url( $att_id, ‘full’ ); // full-sized URL But to set the … Read more

How to use MediaUpload outside of editor

The answer is actually several steps that took me lots of experimentation, but it comes down to the following code that you need to compile using something like webpack and extract out the libraries, etc: // MediaUploadFilter.js import { MediaUpload } from ‘@wordpress/media-utils’ const { addFilter } = window.wp.hooks const replaceMediaUpload = () => MediaUpload … Read more

Post edit – Media Library – Only get images from current post

This will lock uploads to “Uploaded to this post” and will not show “All media items” or other options in WordPress media panels. Add this code to your function.php file add_action( ‘admin_footer-post-new.php’, ‘firmasite_mediapanel_lock_uploaded’ ); add_action( ‘admin_footer-post.php’, ‘firmasite_mediapanel_lock_uploaded’ ); function firmasite_mediapanel_lock_uploaded() { ?> <script type=”text/javascript”> jQuery(document).on(“DOMNodeInserted”, function(){ // Lock uploads to “Uploaded to this post” jQuery(‘select.attachment-filters … Read more

Pulling images from a subdomain

Managed to solve it myself.. So if anyone else has this problem. Because the sub-domain is still under the main domain you do not have to put – /home/hostname/subdomain.com you only need the /home/sub-domain.com and everything will work.. hope this helps someone.. Richard

Audio file’s length (duration) is missing from Attachment Details in Media Library [closed]

I found that this issue could be overcome by opening the mp3 file in the excellent Linux/Windows application Mp3 Diags and applying the Rebuild VBR Data transformation. It discards the file’s Xing header and attaches a new one. After doing this, the files’s duration and bitrate are listed in it’s Attachment Details when it is … Read more

“Organize my uploads into month- and year-based folder” Option Not Visible in Multisite

All credit to: https://chiroiu.com/blog/disable-month-year-based-uploads-on-wordpress-multisite/ Disable month- / year-based uploads on wordpress multisite Wordpress / January 30, 2020 By default wordpress organises uploaded media into month- and year-based folders. Probably a relict from when it was mostly used as a blogging tool. You can disable this easily enough under Settings > Media. On a WordPress Multisite … Read more

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