An attachment is an image or other file uploaded through the post editor's upload utility. Attachments can be displayed on their own 'page' or template. For more information, see Using Image and File Attachments.

learn more… | top users | synonyms

4
votes
1answer
1k views

simple solution for restricting access to (some) uploads/downloads

Initial Situation For a site I'm setting up I was looking into the whole field of securing uploads/downloads and restricting access to them based on user roles/capabilities. Of course I have read ...
0
votes
0answers
135 views

uploading Attachments with permalinks based on parent file structure

We are rebuilding a public-interest site centered on civil rights research & document archives. The links in years of published info posts must be preserved in WordPress, and future uploaded ...
0
votes
0answers
71 views

Editing with thickbox in wp-admin - Endless loading

I have a plugin with images inside wp-admin. Works fine without thickbox When clicking on an image I can edit them with this URL: ...
0
votes
1answer
128 views

get_attachment_link() adds a hashtag to URL

I'm using the get_attachment_link() function in a site I'm developing and it's returning a really weird result. For some reason it adds #main at the end of every url. ...
0
votes
1answer
51 views

How to retrieve images contained in a post

I'm working with the new media manager, and have a little issue to retrieve the attachment of the post. I'm developing a plugin which needs to retrieve all attachments of specific posts. I first ...
0
votes
1answer
102 views

Bulk Attach Or Insert Media To Post Without Opening Post Editor

How to create a custom panel inside wp admin dashboard where we can insert media to specified posts in bulk? Here is the illustration: As shown on the image above, it list all available media on ...
0
votes
1answer
172 views

How to search for post content and attached file names

I need to extend standard WP search functionality so that the search term is also applied to files attached to a post. In other words if user types in "annual report" then search results would include ...
0
votes
0answers
87 views

Add to the library a media from a subfolder

I'm trying to upload some media to the media library in a "uploads" subfolder. The problem is that the media is added, I can see a new entry in the media library, the database the guid of the file ...
1
vote
0answers
76 views

Show message in media-new.php

I'm wondering if there's a way to show a specific message when user uploads a file using the wp-admin/media-new.php script. So far I have this: function my_uploads_notice(){ global $pagenow; ...
0
votes
0answers
88 views

How to upload images using <form> as a post thumbnail?

In my custom image upload form, codes are (generally): if(isset ($_POST['submit'])=='Submit') { $product_image_1=$_POST['product_image_1']; $product_image_2=$_POST['product_image_2']; $newPost = ...
0
votes
1answer
98 views

How to attach images that I “insert from url” into the post?

I'm trying to get the list of images in my post, to display them in the front page... the problem is that when I add a new picture from a URL, it doesn't seem to attach it. $images =& ...
0
votes
1answer
215 views

How to add filetype to meta value when using wp_upload_bits?

I've set up a custom post type and would like to have the ability to attach files to those posts. I've got the CPT and metabox set up, and the upload function as well. When I display the CPT on the ...
4
votes
1answer
101 views

Theme Customiser Image Control

I'm aware that one can add a control to the theme customiser to add an image. This control returns an image URL however, and I need its attachment ID, not the image URL. Where can I intercept or ...
2
votes
1answer
303 views

Delete attachments from Front end

I am trying to make a simple media manager on the front end of my posts, as my site will have many authors. I want to give them the ability to delete any picture attachments that they have uploaded to ...
0
votes
0answers
240 views

Delete associated thumbnails when calling wp_delete_attachment

I have a somewhat straightforward script that allows users to upload their own avatar from the front-end. Another script allows them to delete their avatar, before uploading another. The ...
0
votes
2answers
195 views

How to move image attachment from post to another?

How to move image attachment from post to another (not to "Remove Permanently" and Re-Upload) ? I'm using WordPress 3.5.0 and I have a thousand images to process. Is there a built-in function for ...
0
votes
1answer
412 views

Retrieve Image Attachments Getting Post Thumbnail Image First

I have written a funtion to get post image attachments, is there any way of ordering these images such that the first is always the post_thumbnail? Code below Thanks John function ...
2
votes
1answer
28 views

Set attached to state

In the media library every attachment post has an "Attached to" column. I've developed a plugin that adds author profile and a facebook like banner image. I now discovered that the attachment posts, ...
1
vote
0answers
169 views

How to create resized versions of images added with wp_insert_attachment

I'm uploading images to my media gallery and setting them as my post's featured image, which is working quite well. I'd like to generate thumbnails of these featured images, in the same way that ...
0
votes
1answer
43 views

What is the most efficient way to retrieve a group of image URL's from different attachment ID's of a specific crop size?

I have a basic slider plugin that I am attemping to make more efficient. This plugin collects an array of attachment ID's from the user to represent each image of the slider. With these attachment ...
0
votes
0answers
40 views

Linking Attachment page to another attachment page of larger size

I am not sure is it really possible. I have a gallery. But few years ago, I did not cared to make the image size on attachment page full size. You know what I mean, attachment page shows default size ...
0
votes
0answers
218 views

Make Add media button accessible to all in front end

I am trying to add an interface in which any user(including non logged in) can create a post from the front-end. I am able to bring the default wordpress editor to front-end using the wp_editor ...
0
votes
0answers
60 views

Custom post types images go to a specific folder, not the montly one

I have a website which allows "mini sites", meaning custom post types. We noticed that the images that are published along the mini-sites reviews go automatically to the same month, while regular ...
0
votes
0answers
93 views

delete attachment for one post without deleting actual attachment post

I'm writing custom ajax calls for media attachments from FrontEnd, I have everything read to use, except the actual logic. I'm using WP E-Commerce plugin, where I want many images for one post. And I ...
0
votes
1answer
225 views

Upload unnattached image from frontend

I am using the below function to let users upload files from the front end. It works great except that I would like the file to NOT be attached to any post. Currently, the file is automatically ...
-1
votes
1answer
68 views

How to link images of one WP site to another WP site?

My first site is having 92 categories to display more than 10,000 SMS. Now I want to insert random images to all my posts (SMS) from my other site which is having images as per my categories in SMS ...
0
votes
2answers
158 views

the_time() returning wrong date/time (way in the future)

Within a loop, that otherwise works fine, the_time() is giving me a date and time about 25 days and a few hours ahead of the actual date.For instance, if I post today, it lists it as "April 30th, ...
0
votes
1answer
314 views

Problem adding MP3 attachments to a jPlayer playlist

I'm trying to get a post's mp3 attachments working with the jplayer plugin (with playlist addon). I have it working for a set number of attachments, but am failing to find a dynamic solution for any ...
0
votes
2answers
466 views

How to create a multidimensional array with multiple loops

I have this loop where I loop through every post of my CPT and fetch the title and the content of each post and put it into an array. That is no problem. But as it happens I have created a repeatable ...
2
votes
1answer
143 views

Rename attachments during upload

Here's the function I use for WP to rename images during upload on the fly and set the image's filename to match the post slug. function wpsx_5505_modify_uploaded_file_names($arr) { // Get the ...
0
votes
1answer
107 views

How to let a role handle media without post permissions

I have a CPT to replace my "post"-post-type, but I still need to be able to use attachments. The problem is, that attachments have the post-capabilities. I don’t want to give post capabilities to my ...
0
votes
1answer
144 views

Import Dummy Content and Post Thumbnails

I am setting up a small dummy content plugin. What I would like to do is import several posts using wp_insert_post. Then I would like to import several images using wp_insert_attachment and then ...
0
votes
1answer
88 views

Hiding or removing file extension displayed in HTML on attachment page

I’m doing up a photography theme in WP at the moment, and I’ve already got great help on this thread (thanks Milo!) for a previous question. In that thread, I asked about displaying the file name of ...
1
vote
2answers
208 views

Image rotation fails to regenerate custom sized thumbnail

I'm using custom image dimensions in functions.php like this: add_image_size( 'custom-size-thumbnail', 120, 120, true ); I uploaded some pictures with wrong orientation, so I used "edit" options to ...
1
vote
3answers
156 views

Out of memory error reporting

When users upload very large photos and memory is tight, it seems like Wordpress runs out of memory - fails to resize the uploaded photos and does not create the necessary metadata ...
2
votes
1answer
373 views

rename attachments based on parent-post-title on upload

I know there a some functions already avaible here for this task, but none of them seem to work as needed. The best way seems to me adding a filter to wp_handle_upload_prefilter like kaiser does in ...
0
votes
1answer
140 views

Adding attachment file name to email link

I'm doing up a photography site where each post is a photo project, and each post attachment will be displayed on its own attachment page (linked to from the main post page). On the attachment page, ...
1
vote
2answers
2k views

How to single click to download image in single post

i have attacment.php like this. <?php if ( $attachments = get_children( array( 'post_type' => 'attachment', 'post_mime_type'=>'image', 'numberposts' => 1, 'post_status' => ...
5
votes
1answer
898 views

Saving images from Gravity Forms repeatable File Upload as post attachments

I am trying to upload multiple images as attachments to a post using Gravity Forms and the Gravity Forms + Custom Post Types plugin. I have a repeatable File Upload field using the Gravity Forms ...
0
votes
1answer
129 views

Change filename during upload

I check the below answer to rename files during upload and tries to change it to something like postid_originalfilename.jpg but failed. Any help? function make_filename_hash($filename) { $info = ...
1
vote
2answers
397 views

Link all Wordpress images size

How i can link all different images size upload in wordpress? I've definited different size image with the plugin simple image size so i'ld like show in single post, links to all new images example ...
0
votes
1answer
39 views

Image attachement management - a philosophical question

I'm building a theme which includes displaying images which are not embedded in the body of the post by the user. I understand the correct approach to this is to use the concept of attached images - ...
-1
votes
1answer
123 views

Custom Fields, Media uploader, Attachments

I have added Custom Fields to the Media Uploader in WP3.5. I am unsure of how to have that data displayed on the Attachment page.
2
votes
1answer
152 views

Rename attachments during upload no matter what filetype

Here's the function I use for WP to rename images during upload on the fly and set the image's filename to match the post slug. function wpsx_5505_modify_uploaded_file_names($arr) { // Get the ...
4
votes
1answer
825 views

How to paginate wordpress [gallery] shortcode?

I am using wordpress gallery shortcode [gallery] I was wondering if there is anyway to paginate them without using a plugin.
0
votes
1answer
162 views

How To Download WordPress Audio Attachments

I've been searching high and low trying to figure out how to create download links for audio files uploaded to a post. I know how to display the audio url directly into the theme template, but when ...
0
votes
1answer
432 views

Ordering of gallery images without using shortcode in theme

I using the built-in gallery in wordpress to store and sort images inside a custom post type. In the theme I was using: $attachments = get_posts( array('post_type' => ...
0
votes
2answers
116 views

get_permalink to attachment not working

I have following code <?php $args = array( 'post_type' => 'attachment', 'numberposts' => 12, 'post_status' => null ); $attachments = get_posts( $args ); if ( ...
1
vote
1answer
451 views

Insert custom ID into wp_get_attachment_link

I'm working on this function of WordPress. function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { $id = intval( $id ); $_post = ...
0
votes
0answers
18 views

wp insert attachment from local drive [duplicate]

Is there some way to upload images from local drive to posts without using dashboard. Something like function wp_insert_attachment, bur for that function is a rule that files must be on server.