Questions tagged [media-library]

Media Library is a WordPress panel that display all files you've uploaded. There you can add new files, attach files to posts and pages etc.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

How can comments be turned off for media attachments on Wordpress?

I want comments always turned off for media attachments. I wrote the following codes to accomplish this. But this code is not working. I've also reviewed many similar topics: Resource-1, Resource-2, ...
1 vote
0 answers
14 views

Retroactively change Permalinks for media files after disabling year/month format

Disabling "Organize my uploads into month- and year-based folders" works as expected for new files uploaded. What I have not been able to find is if there is a way to also "move/...
0 votes
1 answer
7 views

Add Filename Colum to Media Library

I know this has been asked before: Add file name column to media library I tried the code. The Filename column was not polpulated. Then I followed Instead of substr( strrchr( $meta['file'], '/' ), 1) ...
  • 21
0 votes
0 answers
13 views

Question regarding the file path for media_sideload_image and wp_upload_dir()

Just need some advice on uploading images. I am using ACF / oEmbed to display a video in my blog and in the process extracts the thumbnail from Wistia which works fine. However, I need to put the ...
0 votes
0 answers
9 views

How can I modify the code generated for a PDF by the Add Media button in Classic Editor?

I am still using the Classic Editor. When a user creates a Post and uses the Add Media button to insert a PDF from the Media Libary into the Post, the generated code is something like this <a href=&...
  • 753
0 votes
0 answers
18 views

Is there a way to programmatically pass a category to the Media Library selector?

In the admin panel of my plugin I am able to make a form that uploads an image to the media library. The form's action page redirects to a post processing file that gets an $attachment_id, and then ...
0 votes
0 answers
24 views

Set a minimum and maximum limit of images to select in the MediaUpload component for Block

Say that I am making a Block that accepts between 2 and 5 images with the MediaUpload component as input. How would I go about that? Ideally for UI I would like the multiple and addToGallery props to ...
0 votes
0 answers
13 views

Uploaded images result in a file url with full path on disk appended

Problem: When I upload an image using Wordpress media gallery the file is written properly to disk, however the file url contains the full path on disk instead of the relative "/wp-content" ...
1 vote
1 answer
36 views

How to make media URLs Unique

I am having an issue with my project that requires my media URLs to be unique. I have found that if a media item is uploaded, deleted, and reuploaded with the same name in the same month, then the URL ...
1 vote
2 answers
120 views

Bulk delete media by year

We have large media library with more than 300000 images. We decide to delete all images < 2017 year manually using "FTP", from WP upload folder. But after that in WP Admin > Media >...
0 votes
0 answers
17 views

Why does "updated_post_meta" did not fire when uploading media other than image?

I am testing out the "updated_post_meta" hook by uploading items to media. I have notice that the hook is not firing if I am uploading files other than image. So I check the post_meta table ...
0 votes
1 answer
24 views

Programtically selecting image URL in Media Library modal

I've been struggling with Backbone for a few hours now while I'm trying to select a custom image URL in the media modal. The idea is to have a button that I've coded already and when the user clicks ...
0 votes
0 answers
13 views

User media folder for each users on registration

i need to create a "user folder" in media library for user registration using usermeta field, for example "billing_company".. so, my purpose is to procect file url inside that ...
  • 1
0 votes
0 answers
9 views

Change image data durgin upload

I try to change image filename and image meta during upload to media library. I have a problem with create unique filename hence, a bad slug is generated. Also, during upload, file uploaded by this ...
  • 1
0 votes
1 answer
28 views

How to stop media_sideload_image from running when deleting a post?

I have a code that downloads an image and saves it to the media library when you save a post that uses a certain block. The code runs perfect but downloads the image again if you delete the post. How ...
0 votes
0 answers
14 views

WordPress not showing manually uploaded files in Uploads folder on Media Library

I'm having a script on my wordpress site that uploads file to my site directory at wp-content/uploads while .mp3 is the file extension uploaded by that script. This script worked successfully but when ...
0 votes
0 answers
15 views

How to re-house images in uploads/YYYY/MM

My media items are not stored in YYYY/MM subfolders of uploads. Instead, I had cooked up some scheme to ingest posts, but seem to have declined/neglected to organise them that way. So, I've got a ...
1 vote
1 answer
23 views

Use custom image size in admin panel

I have add some image size like: add_image_size( 'custom-small', 600, 600 ); add_image_size( 'custom-medium', 1280, 1280 ); add_image_size( 'custom-large', 2560, 2560 ); and I have removed all the ...
  • 13
0 votes
1 answer
129 views

Update media library image shown in "attachment details" when using wp_insert_attachment to add item to the media library

I'm using the function wp_insert_attachment() to run on a form submission from GravityForms, take a file uploaded in the form, and add it to the WordPress Media Library. Code in functions.php below, ...
  • 176
0 votes
0 answers
100 views

Remove duplicate media entries from mysql database

I am wondering if you can help. I have a wordpress site with 90000 media entries, but only 1000 images. I do not want to remove the images from the media gallery just the entries in the database that ...
0 votes
0 answers
28 views

Larger preview thumbnails in Media Library

Is there a way to force the Media Library to use bigger preview thumbnails in grid and list views?
0 votes
0 answers
20 views

Filter Media by attached page or blog post in Library

I am trying to create a filter using restrict_manage_posts that will filter all media according the page or post type that have been attached to. Actually i need to create a filter that refers to the ...
1 vote
0 answers
61 views

Offload Media Library to other domain on a different server

How is it possible to change the media storage of Wordpress to a subdomain on a different server. The main domain example.com running on a server pointing to IP 192.168.0.1 and I've created a ...
0 votes
1 answer
48 views

Add media button always inserts media on the next wp_editor instance when created dynamically

This is a really weird issue. I am trying to store data from a form in a plugin settings page and allow users to add html code with wp_editor. The users can dynamically add as many fields as they want ...
  • 205
3 votes
0 answers
180 views

Using the <MediaUpload /> component outside the editor. select('core') is null

I am using the WordPress components in the admin panel of my plugin and trying to make an image upload button. The button works fine and allows me to select an image, but when I select an image, I get ...
0 votes
0 answers
11 views

Custom image sizes showing in Classic Editor only when upladed directly to post

I can't get custom image sizes to appear in Image details size selector unless the image is uploaded directly in the post. If you choose an image from the Media library only default image sizes are ...
  • 1
1 vote
1 answer
38 views

Fallback media image for featured image not working in admin column

I want to display a fallback image if a custom post type does not have a featured image set and displayed in a custom admin table column. However all that is being output is the image url and not the ...
  • 125
0 votes
0 answers
192 views

get all images from the wordpress media library with link to the post they are associated with

I'm trying to get all the images from the wordpress media library with link to the post they are associated with. I'm using this code, I get all the images, but the link is the link to the URL of the ...
1 vote
1 answer
490 views

How to upload images in a specific folder using API

I have installed wordpress plugins Real Media library, Real Physical Media, and Media file renamed. Using this I am able to physically move images and organize images in the upload folder as per ...
0 votes
0 answers
15 views

How can i sorting and display image order by siz in media library?

How can i sorting and display image order by size in media library? Sorting is important for me? Any one can help me please?
1 vote
1 answer
56 views

Media library style not loading correctly when selecting a page featured image?

I'm trying to set a featured image to some pages, so when I press select featured images the media library upload UI not loading correctly its own stylesheet ( get images and search are working ...
  • 21
0 votes
0 answers
13 views

How to create wordpress media library UI on plugin page

I am trying to add this media library user interface just like it's used in WordPress. I have attached the image below. I know about the WP_LIST_TABLE class for creating tables, now what class do I ...
  • 561
1 vote
0 answers
496 views

Insert woocommerce products programmatically with featured image and gallery

I'm inserting WooCommerce products programmatically to the database, but I'm having trouble inserting and linking first image as featured image and multiple images for gallery assigned respectively to ...
  • 11
0 votes
0 answers
9 views

Media Library / Backend: How can I search for text in the ALT Text field?

By default, a search in the media library of WordPress 5.9 finds only media items which contain the search string in the following fields: Title Caption Description In other words, it does NOT ...
0 votes
0 answers
39 views

Wordpress Media Import, images not in Media Library

I have performed two imports using the WP Importer plugin, one of a custom post type and the 2nd of the Media Library. Both imports appear to work, on fact a second attempt to import the Media Library ...
2 votes
1 answer
55 views

Media library storing files in uploads not folders within in uploads

I am working on a site rebuild, I need to preserve about 100 blog posts that include images. I was having issues exporting the images and I decided to just download them via FTP. However, I found a ...
0 votes
0 answers
134 views

Filter images from media library by guid meta field

I am using the ajax_query_attachments_args filter attempting to remove certain images from the wordpress media library. They are all in a separate folder within the uploads directory called "...
1 vote
0 answers
148 views

Media Library Grid View Custom Filter

I'm trying to use the Backbone, customizing the Author Filter in media library grid view. I found lots of information on the Internet, and create filter on the toolbar. But there is one error I can't ...
1 vote
0 answers
72 views

AJAX - save an $_FILES picture in media library

From an array like this Array ( [file] => Array ( [name] => 100522738.jpg [type] => image/jpeg [tmp_name] => /Applications/MAMP/tmp/php/phpv9nkXY [error] => 0 [size] => 41784 ) ) ...
  • 23
1 vote
0 answers
29 views

How to enable sorting in custom media uploader in plugin

In my plugin I need a media uploader exactly like the one you see when you select a post's featured image. I managed to do almost everything with this code: media_uploader = window.wp.media({ ...
  • 21
0 votes
0 answers
167 views

How to upload large media file in chunks, without any plugin?

How to upload large media file in chunks, without any plugin ? I have done something like this, it's uploading the file, but after uploading the media file, the uploaded file is not visible in media ...
  • 13
0 votes
1 answer
13 views

Launch Media Library for specific MU site

I have a form on my front end that I'd like to call a media library modal, but I want the library accessed to be a specific MU subsite. I trued to switch_to_blog around the wp_enqueue_media function, ...
  • 913
0 votes
0 answers
21 views

Possible to show in media library if images are being used as featured images?

Is it possible to make an admin column in the media library that will indicate whether or not an image is used somewhere as a 'featured image'?
0 votes
0 answers
21 views

How to locate the js code and php code for certain function?

For example, I want to debug the code for uploading an image when composing a post. I click the "Add Media" button, right-click on the "Media Library" tab, click the "Inspect&...
  • 103
0 votes
0 answers
15 views

How to validate image with specific height and width selection in media selector

Is it possible to validate images with specific heights and widths in WP Media Selector, when user select image? <div class="form-field pwb_brand_cont"> <label for="...
  • 153
0 votes
0 answers
11 views

Bulk Image Resize for Media Library, but for ENLARGING instead of Shrinking

I have hundreds of images in my Media Library. I know there are many plugins that can do Bulk Resize, but all those I've seen only allow you to set a Max Size (you can't enlarge small images, only ...
  • 101
0 votes
0 answers
373 views

Using WP-CLI "wp media import" to sync files to the media library

I'm rebuilding an old website which is 3 years old. The new website has a different sitemap and media files. For this, I have created a fresh WordPress install. However, I'd like to maintain the old ...
  • 1,973
0 votes
1 answer
195 views

How to limit the number of images displayed in the media window?

I have a lot of images in my website, so when I open wp-admin/upload.php the server slow down. Would be possible to display only 50 images per time? I saw there is this similar question, but it works ...
0 votes
0 answers
672 views

“The REST API did not process the context query parameter correctly.” Custom theme conflicting with Media Library

I'm having the “The REST API did not process the context query parameter correctly.” error message on a custom theme, the media library isn't working correctly. I do have shortcodes on my function.php ...
  • 1
0 votes
1 answer
35 views

Migrating media files (documents only) to a fresh install and maintaining the same directory structure

I've rebuilt an old website from scratch on a fresh install. On the old (production) website there are over 1000 PDFs and Word docs. These have been uploaded over a 3 year period via /wp-content/...
  • 1,973

1
2 3 4 5
20