Skip to main content

Questions tagged [media]

An image, audio or a video comprises a media.

428 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers
107 views

Saving WordPress generated thumbnails in a subdirectory

I.e. an uploaded image image.jpg is stored in wp-content/uploads/2016. WordPress will generate thumbnails named image-150x150.jpg, image-300x300.jpg, and image-1024x1024.jpg in the same directory. Is ...
kamath's user avatar
  • 41
3 votes
1 answer
356 views

How do I display a PDF thumbnail as a link to the PDF without uploading the image

When I found a couple of years ago that WordPress will create thumbnails of uploaded PDFs, I was so happy, thinking I wouldn't have to make and upload separate PDF cover images to have a thumbnail ...
bkepl's user avatar
  • 131
3 votes
0 answers
625 views

Retroactively place uploaded media into -month, -year based folders?

I am working on a client's site. It has about 8GB of images in the uploads folder. Unfortunately, from day one, years ago, uploaded media files were not set to be organized into month-, year- based ...
Mauricio's user avatar
3 votes
0 answers
231 views

Add custom tab on the media manager

I want to add a new tab and its content on the media manager. I have used add_filter('media_upload_tabs', 'mime_type_tab' , 1 , 1 ); but that filter it is not working on the featured image pop up.
Ravi Shakya's user avatar
3 votes
0 answers
590 views

Media upload via backend doen't work after moving site

I have copied my site to a subdirectory for test purposes, everything works fine now. The only problem I have seen so far is the Media upload. When I try to upload a file I get a: Unable to create ...
Vika's user avatar
  • 31
3 votes
1 answer
1k views

How to disable drag-and-drop upload function in Media Library?

Does any one knows a valid/standard way to disable drag and upload when accessing the media library in the admin area? In order to make this sense to you, I'm building a multisite and user of sub-site ...
Dbx's user avatar
  • 31
3 votes
0 answers
2k views

Custom media picker in meta box: how to select available image sizes?

I have a custom meta box where a user can select an image and save it using wordpresses media picker, set up with some JavaScript. That works fine, but I'd like the option to select which version of ...
ptf's user avatar
  • 423
3 votes
0 answers
187 views

Category checkboxes in upload modal

In a project I'm working on, I've enabled categories for attachments using: register_taxonomy_for_object_type('category', 'attachment'); In the edit attachment screen in the Media Library you see ...
leemon's user avatar
  • 1,938
3 votes
3 answers
2k views

Retrieving JSON data in ajax request from media uploader

I'm having some problems getting my JSON data that's being passed via an ajax request. I'm trying to implement the media uploader into a plugins settings page. I've got it functioning properly using ...
gregz's user avatar
  • 31
2 votes
0 answers
42 views

Add to Media Inserter Categories

As of Wordpress 6.2, Openverse was integrated into wordpress and it is available under the Media Tab of the Inserter. I want to develop a plugin that integrates another stock image service into the ...
merctraider's user avatar
2 votes
0 answers
635 views

How to change upload directory based on frontend form input name or ID?

I created a frontend form using a plugin which allows logged in users to create draft posts. There are 3 file upload areas. I need 1 of them to use the default public WP media upload folder as usual. ...
user197754's user avatar
2 votes
0 answers
319 views

How to search media library alt text and title fields

I need to be able to search in the WordPress media library alt text and title fields. I've previously used a plugin called Media search Enhanced by 1fixdotio (https://wordpress.org/plugins/media-...
Andrew Abbott's user avatar
2 votes
0 answers
155 views

How to host different file formats/types for a media attachment without creating multiple attachments?

For a better browser compatibility we often have to maintain multiple format of a media. For example: Image - JPG & WebP Image animated - GIF & WebP Image transparent - PNG & WebP Video - ...
Sisir's user avatar
  • 7,772
2 votes
0 answers
168 views

wp_get_attachment_image_src() returns wrong url

wp_get_attachment_image_src() is returning a wrong image url. It returns the original url instead of the cropped one. Here some example code: $ptId = get_post_thumbnail_id( $productId ); ...
Ferdy Fiers's user avatar
2 votes
0 answers
46 views

How to re-arrange media uploaded using : media_handle_upload() as per year / month

I have been facing this issue that all the new media files are getting uploaded to single folder which was auto-generated during initial site development. Now since all new images are getting uploaded ...
Siddhesh Shirodkar's user avatar
2 votes
0 answers
669 views

Wordpress API returns empty page when page is less than X-WP-TotalPages

I am querying in the Wordpress API for all pages of media attachments. I am going page by page. I have about 5800 pages and when I hit pages 50-53 they return a blank or more of a [] but it is a ...
Kyle Calica-St's user avatar
2 votes
0 answers
2k views

move_uploaded_file() not working on wordpress front end

I have working code that uploads an image from the front end and sets it as a featured image and custom field photo for a custom post type but I am unable to figure out how to set the upload path. ...
theone581's user avatar
2 votes
0 answers
188 views

Is it possible to change 'Link to' in all images in all articles?

After some update, they all changed to none. Need to change to 'Media file'. Can I do it once and for all pictures in all articles? I see in the text of article difference between images with Link To ...
IAfanasov's user avatar
  • 121
2 votes
1 answer
612 views

How to install/enable mediaelement.js plugins in WordPress

MediaElement.js has a lot of useful plugins, such as jump forward, skip back, speed, etc. From my understanding (please correct me if I am wrong) WordPress core contains only MediaElement.js -- ...
jsmod's user avatar
  • 501
2 votes
1 answer
60 views

Bulk image importing from folders

I have hundreds of different named folders with various amounts of images inside each. I uploaded the folders to the wp-content/uploads directory. How can I import all at once into the media library (...
jjredmond's user avatar
2 votes
0 answers
52 views

How to stop unlink images when remove a site or user

What's the best way to prevent images deleting?. I have a central cdn site to share images to several sites on wordpress multisite, and by mistake, I have remove a user from the network and all my ...
TorryVic's user avatar
  • 153
2 votes
0 answers
160 views

wordpress multisite subsite rewrite rules not working for videos

We have an issue on our site whereby videos uploaded to posts on subsites are returning a 404 when attempted to be viewed, whereas for instance images attached to subsite posts display just fine. We'...
Kinoian Web's user avatar
2 votes
0 answers
72 views

Sending custom data with Media Frame Model

I have an option on post edit screen that can change it to full-width. Unfortunately, $content_width still follows the standard one with sidebar 780px (without saving the post or a whole refresh). I ...
Sam's user avatar
  • 21
2 votes
0 answers
430 views

Multisite media library uploads broken images

I am having an issue with one of my sub-sites media library. All it uploads are broken images. It loads fine locally but for some reason it gives me the error "Failed to load resource: the server ...
Michael Stokes's user avatar
2 votes
0 answers
727 views

Media is shown in listview but not in gridview whenever i activate my Custom Theme

Whenever I activate my custom theme the media is shown in list view only not in grid view. When I checked it by inspect element data is not coming in it and when i try to upload any image it shows me ...
Kamal Paliwal's user avatar
2 votes
1 answer
485 views

WP Media uploader loading only once in options page

A weird issue happening with me which I am unable to fix. In my theme options page, I added options to upload images one for logo and another for backgroud image. Here is my HTML <table class="...
Ayanize's user avatar
  • 247
2 votes
2 answers
5k views

How To install AWS SDK for PHP in wordpress?

I am going to install and use AWS SDK for PHP to facilitate uploads/list objects directly from the front-end of my WordPress instance to S3. What is the best practice to do that ? P.S: I don't want ...
armin's user avatar
  • 47
2 votes
1 answer
101 views

Disable mouse image resizing in editor

I want to disable the mouse image resizing function in wordpress standard editor. So that its not possible to resize the default image size when you select an image and pull on it. Any idea how i can ...
public9nf's user avatar
  • 386
2 votes
0 answers
42 views

Add input to the media uploader and pass its value to each uploaded file

Suppose I have a select element containing a list of my custom taxonomies or terms, I need to add it to the media library uploader so that the admin can choose the custom taxonomy to which he wants to ...
Hazem Taha's user avatar
2 votes
0 answers
1k views

How to delete uploads not in media library?

How to delete uploads not in media library? I have lot of images in my uploads folder but doesn't in media library. Exist some method how this do it?
user2219071's user avatar
2 votes
1 answer
542 views

Different upload path per file type

I want to have two different paths for different files. For example, I have all .zip and image files all in the same locations. What I am wanting to the have images in one path (eg. wp-content/...
idolisedmedia's user avatar
2 votes
0 answers
188 views

wp.media add context

I have wp.media frame on my plugin to upload doc, docx file. I am filtering the uploaded file. If uploaded other than supported file, it will display this error I am filtering it at ...
user98239820's user avatar
2 votes
0 answers
68 views

Add fields to the WordPress media uploader

I am trying to add an URL field to the WordPress media uploader using following code: /** * Add an URL field to gallery attachments * * @param $form_fields array, fields to include in attachment ...
Igor Skoldin's user avatar
2 votes
1 answer
80 views

Organizing media uploads

One of my clients wants to transfer his WordPress website to my server. The problem is his website doesn't use sub-folders in his upload folder, and he has more than 1,000,000 files in the root of his ...
user2093301's user avatar
2 votes
0 answers
692 views

How to make a customized "Create Gallery" tab in the 'Add Media' window?

I'm developing a plug-in and wanting to make a customized version of the the "Create Gallery" tab of WP v4.0, but have the resulting output (i.e. what gets inserted into the TinyMCE editor) to be ...
mwKory's user avatar
  • 21
2 votes
1 answer
299 views

3.5 media.editor: what is the event listener for choosing an image?

What is the event listener for selecting an image in the media.editor javascript. I am attempting to add a multiple image selector to a custom plugin, and I need to show the user what images they have ...
cj5's user avatar
  • 220
1 vote
0 answers
14 views

Wordpress is adding "-1" to the filename of media items

On a website I administer, I just noticed that Wordpress is adding "-1" to the filename. Which is expected behavior for a file that has already been uploaded. But these files have not been ...
Ann Foley's user avatar
1 vote
0 answers
13 views

How to add a post page from a button without reloading

I am a novice in developpement and I am trying to create a page. When I click on the button Gutemberg, it will generate a post page with a text and an image. The problem is that the page is created ...
OceaneEMILE's user avatar
1 vote
0 answers
17 views

How to revert the media structure from /uploads/year/month to the /uploads directory in wordpress?

I tried to use wp-cli using regex like this: wp search-replace 'uploads/[0-9]+/[0-9]+/' 'uploads/' --all-tables --regex but in this case there is a problem with possibly repeated file names and ...
Macsurf's user avatar
  • 11
1 vote
1 answer
257 views

Convert base64 string to WordPress attachment uploads multiple images instead of a single one

I'm trying to convert a base64 string to an image file and upload it into WordPress media library. It seems like the code is working, but, for some reason, every time I call this function it uploads ...
benjah's user avatar
  • 111
1 vote
0 answers
111 views

Undefined array key "width" in wp-admin/includes/image.php error when publishing post or page

When publishing a post or page that includes trusted SVG files in the content, WordPress spits out the errors Undefined array key "width" in wp-admin/includes/image.php and Undefined array ...
Motivated's user avatar
  • 215
1 vote
1 answer
84 views

How can I get all attachments by a user on a WP multisite network?

I'm creating a front-end based project where users can make posts and add images to them. It's a network of sites that users have access to. For a better user experience, I want users to be able to ...
ToongeePrime's user avatar
1 vote
0 answers
51 views

Problem with "is_user_logged_in()" and woocommerce (Code for custom media upload for each author.)

I'm sorry for my english... I am using the following code to create separate media directories for each author.. ( Thanks to https://wordpress.stackexchange.com/a/400352/220907 ) function ...
Andrei Ka's user avatar
1 vote
1 answer
181 views

wp media regenerate says "no regeneration needed" whe that's no the case

I'm trying to generate thumbnails for a PDF attachment. Right now in the uploads/ folder there is only the PDF file, no image thumbnails related to it. But when I run the regeneration with : wp media ...
mike23's user avatar
  • 5,991
1 vote
0 answers
47 views

upload image to wordpress media library failed for custom post type

image upload failed. I tried to upload gym logo as thumbnail image for gym post type. All the form elements are working. But image upload is not working. images are not appearing in WordPress media ...
Safayet hossain's user avatar
1 vote
0 answers
71 views

Give attachments an archive page, and exclude unattached ones

I am extending the use of Media/"Attachments" so that they have a custom taxonomy of "Medium" and I can display taxonomy archives on the frontend. I'd only like the archive query ...
kanga's user avatar
  • 111
1 vote
0 answers
1k views

wp.media Uncaught TypeError: Cannot read properties of undefined (reading 'state')

Here in a JS class, I used "wp.media" to upload images. I can open the media popup by clicking a button. But getting this error (Uncaught TypeError: Cannot read properties of undefined (...
Tarikul Islam's user avatar
1 vote
1 answer
34 views

How can I create more upload paths, like a post corresponding to a post title folder used to store images of the same product

How can I create more upload paths, like a post corresponding to a post title folder used to store images of the same product. Because I want to make a photo album blog, the images within each post ...
29 lee's user avatar
  • 11
1 vote
2 answers
1k views

Restrict WordPress Media Library for a specific user role (users can only see/select own media)

I have 4 roles in my platform : administrator, author, editor, external I need to restrict WordPress media library access to the user’s own uploads only for one users role (external) on my platform. ...
Samuel's user avatar
  • 344
1 vote
2 answers
70 views

Automatically assign video 'poster' value to 'filename' for archive listing

One of my sites is used as a personal diary with >5000 videos uploaded within the media library. Each post uses the following shortcode, disabling pre-load and assigning a manual poster. This ...
helpless_fool's user avatar

1
2 3 4 5
9