Questions tagged [media]

An image, audio or a video comprises a media.

Filter by
Sorted by
Tagged with
0 votes
1 answer
12 views

Does WordPress import export tool keeps the file hosted on the old website?

I have an old website with several GBs of media data. i want to export the media files with wordpress export / import tool to my new website. Wordpress gives me a 10mb .xml file out of the several GBs ...
  • 1
0 votes
0 answers
24 views

Scaling media image results in a png, but WP only refers to jpg [closed]

I'm doing a blog post, same way I always have. I pick an image from Pixabay using the Instant Images plugin (connects to Pixabay, lets me choose an image, then adds it to the media library), add it, ...
  • 441
0 votes
0 answers
9 views

Close featured image modal windows with JS

I'm developing a plugin which let you select a fectured image for a post from an external resource e.g. an API When I select an image, I want the image select window to close. I have tried with: wp....
0 votes
1 answer
53 views

What is the proper use of guid for images in wp_posts?

I understand that guid is a unique reference for a post, whether that post is a post or an attachment. When it's a post, I think guid is self-evident. But what is the correct formulation/destination ...
0 votes
2 answers
35 views

upload image with rest API to the media library

I am working on uploading an image to the media library and then attaching it to the featured image. I put the code below in my functions.php file and submitted a JSON file through postman, but for ...
0 votes
0 answers
17 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 ...
0 votes
0 answers
29 views

How to properly move media files and update data?

Bashing my head against a wall here. I want to write a function that moves the actual file of a Media Library attachment, but this must necessarily update all metadata. I am already doing a foreach on ...
0 votes
0 answers
22 views

Looking for a way to insert PDF image preview in TinyMCE

We're still using TinyMCE as our post editor. When Editors use the 'Add Media' button to select a PDF from the Media Library, they choose the thumbnail or medium size image from the Attachment Display ...
  • 763
0 votes
0 answers
13 views

Is it possible to restrict the number of media uploads (photos) per user?

I've got a community site using BuddyPress and Paid Memberships Pro where I'd like to restrict the number of files a free user can upload. I've seen it's possible as MediaPress has a paid addon, but I ...
0 votes
1 answer
38 views

How To Convert External Image URLs To Own Website's Uploaded Images Automatically?

I have a website with over 300 posts and initially I used to use external image URLs in my blogs instead of uploading it to my DB and using them. Is there any way to automatically get all the external ...
  • 1
0 votes
1 answer
53 views

Image in binary in the data to WordPress media library

A specific API, returns an image in binary in the data. If I need to save it to the server, I can easily do it by following the code. $response = curl_exec($curl); // This is the API response ...
  • 1,772
0 votes
0 answers
11 views

Upload the images folder with sub-folders directly to server

I have a News_images folder with a lot of subfolders in it. Each subfolder contains images for one post. I want to upload the whole News folder to the server then access the subfolders with WP Media ...
0 votes
0 answers
17 views

Custom Search on media files PDF images pages posts

Hi all – hoping to find a code solution for developing a custom search bar in WordPress that searches for both Posts/Pages but will ALSO search for media files such as PDFs and images. Basically I ...
0 votes
0 answers
3 views

Inserting Media on New Post But Hides Previous Uploads for Editor/Contributor

We have a community website where people upload media. However, We wanted to restrict them to upload and attach previously uploaded media so that the previously uploaded media on different post are ...
0 votes
0 answers
16 views

Updating Media Library PDF's in bulk

I've built a new site for my client that uses PDF's from the old site media library. He's redesigned all the pdf's and now has asked me to replace them on site. It should be noted that the old PDFs a ...
  • 101
1 vote
0 answers
29 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 ...
  • 111
0 votes
0 answers
13 views

How to batch-add image file extension without losing DB refs?

I have a few dozen .png image files which do not have a ".png" extension. I know I can batch-add ".png" in macOS' Finder. But I presume this will mean the Media Library items lose ...
0 votes
0 answers
25 views

How to add a column showing real media usage (count) to the media list view?

currently wordpress doesn't show real media usage on the media library. It shows attachments, but a media can be, for example, associated to a post via a custom field, maybe with ACF, or other ways. ...
0 votes
0 answers
19 views

Uploaded images not displaying full size preview or inserting into posts

Original issue I was having an issue where image uploads gave the error “could not insert attachment into the database.” PHP memory limit and other settings are fine Disk space is fine Ran check on ...
0 votes
0 answers
33 views

Add link to media files in backend and modify linked images in the frontend

since a while I am looking for a way to add a "link to" option to the media library in the backend (this is working already - using the filter 'attachment_fields_to_edit') if there is a ...
0 votes
0 answers
69 views

Wordpress API, creating Featured Media from image url (nodejs)

I was tasked to create a service that queries the latest posts from another wordpress site and creates a copy of the post on the wordpress site we manage. It's a relatively simple task but i can't ...
0 votes
1 answer
7 views

Why some images are not allowed to be edited only for thumbnails?

please see this: As you can see, on the right columns I don't have the classic 'apply to' radios, where you can choose to apply modifications only to thumbnails. It happens only with certain images, ...
0 votes
1 answer
30 views

Replace media external links with local links

I use an automatic post importer in WordPress and add the images in post content with the external URL, I want to replace the link with the local site links. DB function could do the trick. eg: ...
0 votes
0 answers
20 views

I am facing problem in loading and downloading Mp3 files

I am facing problem in loading and downloading Mp3 files in my website ( ). Most of the content in the website is of Mp3 file. I am also using cloudflare and wp-rocket. Mp3 file is not fully playing ...
0 votes
0 answers
24 views

How to import external media items into wordpress media library (without using storage)

I want to use image that are hosted somewhere (Blogger), but i didn't want to use my website storage. I recently tried some plugin (FIFU) but it only work with url on post editing window but i want to ...
  • 37
0 votes
1 answer
37 views

Delete all thumbnails & regenerate them?

Is there any safe way to delete all thumbnails and then regenerate them. I tried to use plugins like Thumbnail Cleaner, but after using it + regenerating via popular thumbnail regenerator plugin; I ...
  • 3
0 votes
0 answers
17 views

How to disable direct media file access in nginx or ubuntu for non loggedin users?

I have one requirement, where uploaded files will be visible only to logged-in users, I have tried a solution and it's working perfect in my localhost/ wamp/ apache. But when I move my code to ...
  • 51
2 votes
3 answers
523 views

How to automatically convert images to WebP on WordPress?

I want to convert every PNG and JPEG to WebP on upload so that I can serve WebP and PNG/JPEG without requiring the user to upload a WebP version of every photo. I want to save the WebP in the same ...
  • 21
0 votes
0 answers
16 views

Broken images after importing posts and opening in Gutenberg

I imported posts from a wordpress.com site into my Woocommerce site, and some have broken images. When I open the post to edit, the Gallery in the post is converted to Gutenberg blocks. Not all the ...
0 votes
0 answers
7 views

Automatically add tag (first 4 characters) to uploaded media

I am looking for a way to automatically add tags to media (a PDF file) that I upload to WordPress via FTP. The tag should always be the first four characters of the file name. For example '1234' as a ...
  • 1
0 votes
0 answers
31 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
15 views

How to limit sizes for specific upload programmatically?

In my plugin I´m doing programmatically image uploads from an xml file like this function : function makeMediaFromUrl(string $image_url, string $title, int $post_id = 0) { $file_array = ...
  • 800
0 votes
0 answers
11 views

Hide media for non logged in users

I have found this entry but it doesn't seem to work for me, and as I do not have enough karma I am unable to comment or ask a question: How to Protect Uploads, if User is not Logged In?
0 votes
0 answers
23 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
62 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 ...
0 votes
0 answers
114 views

Get all media from wp-json/wp/v2/media

I'm struggling with a strange issue. I was pretty sure that I can use such a pattern to collect all media: def get_all(url): all_results = [] page = 1 posts_url = "{0}?per_page={1}&...
0 votes
1 answer
29 views

How does Wordpress decides how many sizes of an image to create?

Once an image is uploaded to WordPress server, how does it decides how many sizes to create for the same image? I can see for one image, it didn't create any variants, but for a bigger image, it ...
0 votes
0 answers
23 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
0 answers
550 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 (...
0 votes
1 answer
50 views

Serving Images from subdomain in wordpress

This is my current image url https://example.com/wp-content/uploads/2022/06/sample.png served via cloudflare uploads folder is in my wordpress installation I am syncing the uploads folder to Backblaze ...
  • 1
0 votes
1 answer
52 views

Wordpress get_media_embedded

test text <div class="video"> <?php $media = get_media_embedded_in_content( apply_filters( 'the_content', get_the_content() )); print_r($media); ...
  • 1
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 ...
0 votes
0 answers
163 views

Hook on file upload

I need a hook or some way to detect when the window to select the file to upload is opened. I'm talking about the window that opens the browser to select the local files to upload. Context: On ...
  • 17
0 votes
0 answers
32 views

How to get a list of all attachements urls for every post of a wordpress installation?

I'd like to retrieve a list of all attachment URLs for all posts of a website. This would bring something like http://example.com/mypost/attachment-1/ http://example.com/mypost/attachment-2/ http://...
0 votes
0 answers
101 views

Delete Post but retain image of post [WP REST API]

Currently, when I delete a post in my wordpress website, the image is deleted automatically. Which is fine for most cases, however, there are certain posts where I don't want to delete the image from ...
0 votes
0 answers
202 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 ...
1 vote
1 answer
424 views

Thumbnails generated from PDF in the "Media" section - how to show them in theme template?

I have an ACF custom field for "File". It allows users to upload PDF files of some reports. In the Media section in WP Admin, I can see that the PDF we upload auto-generates the thumbnails. ...
0 votes
0 answers
15 views

Access generated thumbnails

Is it possible to allow my editors to access the generated media thumbnails within the media library? So for example, when a user selects an image, they should be able to also select the thumbnail ...
  • 63
0 votes
1 answer
118 views

Double Slash After Media Path (uploads//)

After performing an SEO Audit on my client’s website I found out that several images have a double slash in their URLs. This seems to be happening just to media files, and the double slash is ...
0 votes
0 answers
21 views

wp.media libary pdf type

What would be library type to show only pdf documents in uploader? wp.media({ library: { type: 'pdf' }, }); I tried 'pdf' and 'application/pdf' but its not working, it shows all media.
  • 397

1
2 3 4 5
22