Questions tagged [media]

An image, audio or a video comprises a media.

Filter by
Sorted by
Tagged with
104 votes
4 answers
82k 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,822
49 votes
9 answers
40k 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
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; ...
user1320276's user avatar
20 votes
2 answers
61k 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
  • 495
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 ...
Michael Ecklund's user avatar
11 votes
3 answers
16k 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
  • 17k
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
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
  • 17k
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" ...
Marcin Bobowski's user avatar
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 ...
NetConstructor.com's user avatar
5 votes
2 answers
2k views

Differentiate Featured Image from Post Images upon Upload

I want to differentiate the featured image from post images. The plan is to give the Featured Image multiple sizes, but the images inside / connected to the post only needs the default sizes. I ...
Howdy_McGee's user avatar
  • 20.3k
11 votes
4 answers
9k 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,139
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
6 votes
2 answers
2k views

Image upload callback in new 3.5 media

I am using new 3.5 media uploader in my theme frontend (base on this example). It is very simple when you want to do something with images after the 'Select' button is pressed: file_frame.on('select',...
fornyhucker's user avatar
4 votes
3 answers
8k views

Settings in 'Media > Settings' is ignored when inserting images

When I upload an image, it is automatically resized as I would expect, however the sizes for inserting the image seem to ignore the settings I've placed in Settings/Media. In my media settings I have:...
Gary's user avatar
  • 175
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 ...
Benn's user avatar
  • 993
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
15 votes
2 answers
22k 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
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,225
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.3k
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,386
7 votes
2 answers
2k views

Wordpress Media Manager 3.5 - default link to

Media Manager once again. This time I'm looking for a simple hack/hook/filter to change default "Attachment Display Settings" from media manager. The option is "Link To" that is default set to "Media ...
Marcin Bobowski's user avatar
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
6 votes
4 answers
6k 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
  • 756
4 votes
4 answers
7k views

Resizing all images

I have just changed the theme on my blog, and because of a small page width, it breaks the layout. Most of my earlier images (attached in posts) are around 600px in width, and now I need to resize all ...
GPX's user avatar
  • 327
4 votes
1 answer
1k views

How to protect uploads in multisite if user is not logged in?

I am trying to set up a multisite intranet (using subdomains) where content on each sub-site is only accessible to users logged into their respective site. The problem I am having is trying to ...
acdesigns's user avatar
4 votes
1 answer
4k views

How do I detach images from posts?

Firstly I've seen some topics like this, but they haven't helped me. I've attached some images to a post via "Add Media" : And for showing these attached images, I used following code in single.php ...
Hamed Kamrava's user avatar
4 votes
3 answers
4k views

Set a maximum upload count for users on a specific user role

For users with the Contributor user role, I want to restrict the total amount of images that they are allowed to upload. I found this code posted on an answer here: add_filter( 'wp_handle_upload', '...
Christine Cooper's user avatar
  • 8,709
4 votes
2 answers
4k views

How to make custom bulk actions work on the media/upload page?

I'm adapting a script I found online to add custom bulk actions to the screen with the list of posts. It has this line: add_action('load-edit.php', 'custom_bulk_action'); I'm trying to adapt it for ...
JohnK's user avatar
  • 215
3 votes
2 answers
2k views

Filter what image sizes get generated

I'm looking for a way to chose what images sizes get generated by image. With all the image sizes I have plus a lot of images, in the end I have a whole lot of server space being used up for nothing. ...
Sebastien's user avatar
  • 143
3 votes
1 answer
3k views

custom tabs in media uploader

I've managed to add a custom tab to the media uploader, but for some reason it doesn't come with the same layout - it doesn't load the media-uploader-header that contain all the other tabs: ...
Asaf Chertkoff's user avatar
2 votes
1 answer
4k views

Custom bulk action for media gallery items

I'm trying to add custom "Bulk Actions" to WP 3.5 new media gallery items. I started from this excellent tutorial which does exactly what I need, but with regular posts; so i tried to adapt it to work ...
Torakiki's user avatar
2 votes
1 answer
3k views

How to set additional parameter in wp.media?

I have this code. $('.custom-browse-button').on('click', function(e) { e.preventDefault(); var wpMedia = wp.media.frames.file_frame = wp.media({ 'library': { type: 'image'...
vee's user avatar
  • 233
2 votes
1 answer
16k views

Restricting access to files within a specific folder [duplicate]

Possible Duplicate: How to Protect Uploads, if User is not Logged In? Is there any way at all to restrict direct access to files within a specific folder to only specific wordpress users that ...
NetConstructor.com's user avatar
2 votes
2 answers
2k views

How to extend Media Library (WP 4.4)

I am trying to implement a new tab next to Media Library. I couldn't find solution to implement this. I found an example how to implement a new tab in this link: https://gist.github.com/Fab1en/4586865 ...
minnur's user avatar
  • 123
2 votes
1 answer
1k views

Increase Size Limit of Media Files Wordpress 4.1

I have edited (created) the php.ini file and the .htaccess file in accordance with this post. I have also found a plug-in (called Upload Max File Size) that claims to raise the file size limit of ...
melevan's user avatar
  • 125
1 vote
1 answer
938 views

How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page

This post shows how to remove unwanted fields from the media uploader. It works great, but I want to limit it to a custom-post-type and I can't seem to figure out how to do it. I've tried the ...
user avatar
0 votes
4 answers
1k views

Moving Categories submenu to Media, but still opens Posts menu

I'm developing a very media-centered site with WordPress and am using the default categories and tags on uploaded media using, in part this plugin Media Categories. I am displaying a sub-menu item ...
lowe_22's user avatar
  • 111
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
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
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,534
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 ...
Paul Thomson's user avatar
13 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 ...
Ruriko's user avatar
  • 533
12 votes
3 answers
4k 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
11 votes
3 answers
31k 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
  • 113
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,735
9 votes
1 answer
7k 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
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
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 ...
dingo_d's user avatar
  • 1,919