Skip to main content

Questions tagged [media]

An image, audio or a video comprises a media.

Filter by
Sorted by
Tagged with
105 votes
4 answers
86k views

How to Protect Uploads, if User is not Logged In?

I use WordPress for a private site where users upload files. I use the "Private WordPress" to prevent access in to the site if the user is not logged in. I would like to do the same to the files ...
chifliiiii's user avatar
  • 2,852
49 votes
9 answers
41k views

Restricting users to view only media library items they have uploaded?

I want users to be able to upload photos using add_cap('upload_files') but in their profile page, the Media Library shows every image that's been uploaded. How can I filter that so that they can only ...
TerryMatula's user avatar
37 votes
4 answers
8k views

Add a menu item to Wordpress 3.5 Media Manager

How can add a new menu item underneath the "insert From URL" on the left sidebar in the new Wordpress 3.5 Media Manager? I've been looking at the backbone js and tried my hand at hooking into it with ...
erezie's user avatar
  • 473
33 votes
1 answer
4k views

Pre populate WordPress wp_media modal with image selection

I'm the developer of the Advanced Custom Fields plugin and am hoping you can help me out with an issue I am facing. I have a button where you can edit an image. This button will launch a WP 3.5 media ...
Elliot Condon's user avatar
30 votes
6 answers
207k views

How to Fix HTTP Error When Uploading Images?

I am using WordPress 3.4.1 on Ubuntu 12.04 using Apache and PHP 5.3.X When I login to the dashboard and add a new post. Then try uploading an image to set as a featured image, I get a red box with a ...
Michael Ecklund's user avatar
30 votes
2 answers
6k views

Enhance Media Manager for Gallery

I would like to enhance the Media Editor, after WordPress 3.5, on the gallery view. I want to add a new select field on the right side and send the selected values to the gallery shortcode. I think, ...
bueltge's user avatar
  • 17.1k
24 votes
1 answer
6k views

How to manage attachment relationships for specific posts in WP 3.5+

In WordPress 3.5, media management has changed entirely. Also, relating attachments to specific posts is (I believe) basically only being done for backward compatibility. Therefore, after uploading ...
Brian Krogsgard's user avatar
22 votes
3 answers
7k views

How to add new tab to media upload manager with custom set of images?

I would like to add new tab to upload manager and inside list images from theme_folder/images/patterns I tried something like this to add a tab but it does not work for me since it is adding tabs ...
Benn's user avatar
  • 1,043
21 votes
2 answers
62k views

Add "upload media" button in meta box field

I have a custom post which has a meta tag that needs to be using a file upload (for video files). I am wondering, what is the correct way of adding an "Upload" button that points to the WordPress ...
SpyrosP's user avatar
  • 515
20 votes
1 answer
1k views

wp.media.view.ImageDetails - Save settings as HTML5 data-* attributes for image

What I finally want to achieve are extra settings added to the Image Details box, that will be stored in the image <img> tag as data-* attributes Example: <img src="..." data-my_setting="..."...
Kaspar Lee's user avatar
19 votes
1 answer
2k views

Extend Media Library

The Media Library in WordPress has "Insert from URL" link to the left. It accepts image URLs. It's not said anywhere but if you paste YouTube URL or <iframe> code then it will insert ...
Tom's user avatar
  • 191
17 votes
3 answers
16k views

Prevent Wordpress from generating medium_large 768px size of image uploads?

I prevent WordPress from generating thumbnail, medium, and large image sizes for images I upload to the Media Library, by setting their dimensions to 0 from the dashboard: Settings -> Media panel. ...
user3597545's user avatar
17 votes
3 answers
7k views

How Can I Add the "Insert From URL" Tab to a Custom 3.5 Media Uploader?

I've inserted a WP 3.5 media uploader into a widget by running this JavaScript when a button is clicked on: var frame = wp.media( { title : 'Widget Uploader', multiple : false, ...
Ian Dunn's user avatar
  • 4,837
16 votes
2 answers
3k views

How to make “Upload files”selected by default in Insert Media?

I am frustrated having to click on the "Upload Files" constantly instead of the first choice being Upload Files in posts editor....How can i make “Upload files” selected by default instead of "Media ...
Ghinnersmee's user avatar
16 votes
1 answer
43k views

Update media library files after upload via FTP

I had to upload many files massive and directly to /wp-content/uploads/[year]/[month]/ but those files does not appears in Dashboard>Media>Library Is there a way to update or refresh it to load those ...
Mc Kernel's user avatar
  • 263
15 votes
2 answers
23k views

WordPress 3.5: Setting custom "full URL path to files" in the Media Library?

As the recent changes in WordPress 3.5 removed the "full URL path to files" option from media library I am wondering how to set this option to a custom path now? I need to set my "full URL path to ...
faxxim's user avatar
  • 185
15 votes
1 answer
2k views

For what security reasons are svgs blocked in the media uploader?

I see that SVGs are blocked by default in the media uploader and you have to add it as a supported MIME type in functions.php. What security reasons are behind this?
Claudiu Creanga's user avatar
15 votes
2 answers
3k views

Delete an attachment in the WP media modal window

I'm trying to create an option in the WP modal media window to detect duplicate files and delete a newer file if an older duplicate is found. I have the following code working (in conjunction with the ...
bcorkins's user avatar
  • 505
14 votes
4 answers
25k views

Upload images to remote server

I am using Wordpress media uploader to upload images and I was wondering if there is a way to make it upload to my remote server instead of my local server? Example: My wordpress blog is hosted on ...
Ruriko's user avatar
  • 543
13 votes
2 answers
28k views

"Add Media" button in custom plugin

I'm writing a custom plugin and i would like to add the "Add Media" button. I just need to upload media, not to retrieve any content/data from the uploaded file. How can I add this button? Thanks
Pepozzo's user avatar
  • 367
13 votes
2 answers
7k views

ZIP up all images displayed in a [gallery] and offer as download link

I would like to offer my visitors the option to download the entire photo gallery (displayed on dedicated [gallery] pages) as a ZIP file displayed at the bottom of each gallery page. - The full-sized ...
Paul Thomson's user avatar
12 votes
1 answer
9k views

How can I bulk delete media and attachments using WP-CLI?

I'm trying to mass delete 4000 images in a wordpress website. WP itself sets the max to 999, which would work fine and take a few minutes to delete them via the backend. However, I get REQUEST URI TOO ...
user658182's user avatar
12 votes
3 answers
33k views

Add media with WP-Rest-API v2

I need your help to upload a media image in my wordpress blog via the Wp-rest-api v2 and Oauth2 authentication. I did not find in the REST API documentation the way to send my image data (name of ...
kain34440's user avatar
  • 123
12 votes
3 answers
5k views

Set default image link target in Gutenberg image block

I want to set the default target of the image block in Gutenberg to "Media File": I've found solutions for the classic editor, and one that appears to work for Gutenberg galleries by editing the ...
Sean's user avatar
  • 647
12 votes
1 answer
9k views

what happens to existing media files when I switch to year/month directory structure format?

A site has thousands of images in the uploads folder. ISP has threatened to shut it down because it is about to exceed server limits for the max number of files in one directory. I looked at the ...
Tapefreak's user avatar
  • 356
12 votes
1 answer
1k views

Reject upload of wrong-sized images using the Media Uploader

I'm working on a super-strict setting for adding images to Custom Fields in the Post Edit screen. My optimal scenario would be to add a a Custom Error message when the user tries to upload an image of ...
moraleida's user avatar
  • 2,245
12 votes
3 answers
3k views

How to trigger a refresh in the media modal

I'm developing a plugin that adds a new tab to the media modal, and I need to know a way trigger a refresh of the attachments tab so it shows newly added attachments. This is the code I'm using: wp....
leemon's user avatar
  • 1,938
12 votes
2 answers
3k views

How to make a image-size selected by default in Media upload - WP v3.5

Bare with me. I want to have a custom image size selected by default in the Media upload popup page. In Wordpress v3.4.2 and prior, this elegant code worked fine: function ...
Christine Cooper's user avatar
  • 8,798
11 votes
3 answers
17k views

How to use taxonomies on attachments with the new Media Library?

WordPress 3.5 changed the media management and now the Media Library edit screen uses the default post type UI. Taxonomies are very useful for WP installs with different users and attachments, giving ...
bueltge's user avatar
  • 17.1k
11 votes
4 answers
6k views

Cleanup uploads folder, Media Library db structure

I am doing an upgrade and cleanup of an old blog that started on Blogger.com, then moved to self-hosted WordPress 2.1, 2.3 and now 3.0. Images in the posts are scattered around: most of them are in /...
Jan Fabry's user avatar
  • 30.5k
11 votes
2 answers
5k views

How can you set maximum width for original images?

Case: I have a client that doesn't know much about the digital world. However what she does know is how to get the photo's from her camera on to the computer and in WordPress. However she doesn't know ...
Mark's user avatar
  • 1,029
11 votes
4 answers
10k views

How to add a custom field to the media screen (image/gallery)?

I’m trying to add a custom field to image and gallery edit screen. I’m aware there are similar questions here, although answers either don’t work with the current version or they add field only to ...
Runnick's user avatar
  • 1,009
11 votes
1 answer
4k views

Custom post type with a forced fixed aspect ratio image crop

What I am looking for is similar to a couple other questions. The links are: Creating an Image-Centric Custom Post Type? Using Default WordPress Custom Header Image Crop Feature in a Post Type / ...
Don's user avatar
  • 313
10 votes
1 answer
12k views

How to show all available images in WP's media library when using the Polylang plugin?

It seems that depending on which default language I've set Polylang to, all my uploaded images are isolated so that I can only pick them when I'm editing posts in the default language. I have a lot ...
chamberlainpi's user avatar
10 votes
2 answers
6k views

Media library to list images only user uploaded

I want to list images for only user uploaded image. Here is the scenario: Using the image uploader on front end using iframe. I have added upload_files cap to subscriber level users and want them to ...
Sisir's user avatar
  • 7,772
10 votes
3 answers
14k views

Display Media Uploader in Own Plugin on Wordpress 3.5

I have little problem with Media Uploader in new WordPress 3.5. I created own plugin which is upload the picture. I'm using this code JS: <script type="text/javascript"> var file_frame; ...
user1320276's user avatar
9 votes
5 answers
12k views

How to increase the file size limit for media uploads?

How can I change the Maximum upload file size? I would like to be able to upload 10Mb at a time.
jessegavin's user avatar
  • 3,456
9 votes
1 answer
9k views

Adding Category/Tag/Taxonomy Support to Images/Media

I've been trying to add category, tag, or custom taxonomy support to images (or all media, though I'm only concerned with Images). I've got it part-way figured out with: add_action('init', '...
Roxanne Ready's user avatar
9 votes
1 answer
5k views

Uploading media with the REST API

I am having trouble when uploading media to a WordPress site with the JSON REST API. With the following code I can upload the photos, but no info is assigned to them, not even the name - in fact the ...
Diario de Morelia's user avatar
9 votes
1 answer
4k views

Saving data-URI to media library

I have a TinyMCE plugin that generates PNG images using HTMLCanvasElement.toDataURL() (MDN). Currently, I'm just displaying them on the backend by putting the data-URI in an image tag, but I'd really ...
aendra's user avatar
  • 1,045
8 votes
5 answers
6k views

Wordpress 3.5 Media Manager - add a button

In my plugin, I would like to add two buttons to Media Manager (to the left of "Insert Into Post" in "media-toolbar-primary" section), and connect a jQuery action to it. First one - The "Select All" ...
Marcin Bobowski's user avatar
8 votes
3 answers
44k views

Can't upload media, permissions are correct

I did a manual backup and re-install of a WP site, and it worked fine. Then my client updated some plugins, regretted it and asked me to restore the site to its previous state. I used the same backup ...
brunn's user avatar
  • 353
8 votes
4 answers
12k views

Show only images and videos in a wp.media window

I'm using the following JS code to open a wp.media window to allow users to select images and videos for a gallery. Everything is working as expected, but I'm unable to restrict the window to show ...
leemon's user avatar
  • 1,938
8 votes
4 answers
6k views

Set limit to media upload?

I am searching online and all I can see is how to increase file size for media upload, which I know how to do with php.ini, but what I need to do is limit the file size for media upload only. The ...
dingo_d's user avatar
  • 1,950
8 votes
3 answers
16k views

Saving Media - Which Hook is Fired?

Howdi, I am trying to fire some code that will occur when I save an image in the media library, as per usual, I select the file, upload, enter the meta data and then click save. At this point I want ...
Richard Bagshaw's user avatar
8 votes
1 answer
2k views

WordPress 3.5: Switch back to Old Media Uploader?

Is there any way to switch back to the old media uploader in WordPress 3.5? The new one is very slow for me, as I have thousands and thousands of images across my site, and I have a few plugins that ...
Sal's user avatar
  • 93
8 votes
1 answer
3k views

Rendering the uploaded file in a wp.media object

I have seen this question asked a few times on SO and I don't see any responses. I have a wp.media object (upload dialog), that I am using in to store an upload to a post as a meta element. It works ...
setterGetter's user avatar
7 votes
2 answers
31k views

Wordpress Image Editor not working - conflict?

I am having a strange issue with the built in wordpress image editor. I have no problem uploading files or preforming any other media functions. The only thing I seem to be unable to do is utilize the ...
NetConstructor.com's user avatar
7 votes
4 answers
7k views

Stop WordPress from reserving slugs for media items?

I am experiencing some odd behavior, that apparently happens "out of the box" with WordPress. If I upload a file through the media manager called: services.jpg; then go try to create a page with the ...
Matt Keys's user avatar
  • 816
7 votes
1 answer
6k views

Correct Post Count ( All | Published | Drafts | Pending | Trash ) for Custom Post Type when restricting to view own posts

I want to restrict users in wordpress to view their own post and media items only. Following the steps given in the below link I have developed the plugin to restrict users to view the own posts and ...
Shahrukh Khan's user avatar

1
2 3 4 5
22