Questions tagged [media]
An image, audio or a video comprises a media.
1,075
questions
104
votes
4
answers
84k
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 ...
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 ...
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 ...
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 ...
30
votes
6
answers
206k
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 ...
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, ...
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 ...
22
votes
3
answers
6k
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 ...
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 ...
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="..."...
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 ...
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,
...
16
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.
...
16
votes
2
answers
2k
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 ...
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 ...
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?
15
votes
1
answer
41k
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 ...
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 ...
14
votes
4
answers
24k
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 ...
13
votes
2
answers
27k
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
13
votes
2
answers
6k
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 ...
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 ...
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 ...
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 ...
12
votes
2
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....
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 ...
11
votes
1
answer
8k
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 ...
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 ...
11
votes
3
answers
32k
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 ...
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 /...
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 ...
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 ...
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 / ...
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 ...
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 ...
10
votes
3
answers
13k
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;
...
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.
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', '...
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 ...
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 ...
8
votes
5
answers
5k
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" ...
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 ...
8
votes
4
answers
11k
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 ...
8
votes
4
answers
5k
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 ...
8
votes
3
answers
15k
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 ...
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 ...
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 ...
7
votes
2
answers
30k
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 ...
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 ...
7
votes
2
answers
3k
views
Remove "Insert from URL" link in Media upload - WP 3.5
How do I remove the Insert from URL link in the new Wordpress 3.5 Add Media popup page? In earlier versions of Wordpress, this worked fine:
// removes URL tab in image upload for post
function ...