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

0
votes
1answer
22 views

List attachments of a page

I need to generate a list of attachments uploaded to a specific page (id=628). I thought this code was going to work, but it doesn't generate anything at all: <?php get_header(); ?> <div ...
0
votes
0answers
12 views

Get attachment post id to display attachment custom field data

I have created a custom field for attachment images, for a custom post type, using the extremely helpful tutorial on the process by Andy Blackwell employing the attachment_fields_to_edit and ...
2
votes
2answers
31 views

Check if post has attachments (not image)

Need to do a check if post has attachments that are not images. I haven't seen this anywhere - thoughts?
1
vote
2answers
317 views

Moving 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
2answers
802 views

ID of images from gallery

Does anyone know how to get ID's of images from wordpress gallery in post? I have search entire internet and there is nothing to this subject.
0
votes
1answer
523 views

Load post attached images on a single page site with fancybox

I'm trying to make a single page site that will display posts as thumbnails in some part. Then if a thumbnail is clicked, I want all the images contained in this post to be loaded with fancybox while ...
0
votes
0answers
18 views

Change default URL of image attachment

By default URL of image attachment is: http://www.my-site.com/category/sub-category/article-name/attachment/attachment-title How to change it to this? ...
0
votes
0answers
7 views

How to add jQuery div element to each image on wp site?

I'm trying to add the "Share" button to each of the attachments inside of the post. I found function that allows to get all attachments on the post: ...
4
votes
3answers
565 views

List most recent image uploads, but only for specific custom post type

I can get a list of the most recent image attachments like so: $attachments = get_posts( array( 'post_type' => 'attachment', 'posts_per_page' => $number, 'post_mime_type' => ...
0
votes
1answer
273 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 ...
0
votes
1answer
328 views

Get all attachments by custom taxonomy - term

I want to make custom taxonomy (gallery) and terms (name1, name2, name3...) Add images into media tab and then retrieve all images from same term. Look like simple task, but I cant manage it. I ...
0
votes
1answer
287 views

How to get meta value in wp_attachment_metadata

I want to get wp_attachment_metadata in my own way. I want to separate the sizes (Thumbnail, Large, Medium, Small). The meta value on database looks like this: ...
0
votes
2answers
2k views

Why can I not view image attachment pages?

I have a problem with images. I can see my uploaded images, as previously, through the media library. I can access each image by clicking on "edit". But if I then click on "View Attachment Page", I ...
0
votes
1answer
267 views

Is it important to get the media files attached?

A silly question may be, but I's thinking about the SEO matter, and thinking that, is there anything related to the SEO regarding the Media file attachment? There are 567 images in my Media Library, ...
1
vote
1answer
401 views

How to retrieve attachments from child pages of a specific Page?

How would I retrieve attachments from all subpages of a specific Page ID? Example: SPECIFIC PAGE Child (with attachments) Child (with attachments) Child (with attachments) I'm currently ...
0
votes
1answer
17 views

How to update the title of audio file through its attachment metadata

I am trying to programmatically update some metadata of audio file attached to a post. I have been able to update the artist and album properties of the audio file but title doesn't stick. I can go ...
2
votes
2answers
832 views

Correctly delete posts with meta and attachments [duplicate]

I am having an overview of custom post types. These have custom tax and also an attachment. In my overview I need to provide links to delete the entries. With that I also need to delete the ...
1
vote
1answer
1k views

How to remove title attribute from gallery links and images

I want to remove the title attribute from within the output of a [gallery] shortcode e.g. <a href="url" title="bobby"> <img src="url" title="bobby"/> </a> should be: ...
6
votes
2answers
7k views

Get all image from single page using this query

I'm having some trouble with this sample widget code. I want to get all images (Minus the post thumbnail) from a page called "Gallery" but for some reason this is pulling all uploaded images from the ...
0
votes
1answer
27 views

How do I create Comma Separated list of attached image ids?

I'm trying to grab the image id's of attached images to a post. I'm using an example posted here, but am having trouble returning the just the ids and not the entire array. My goal is to return a ...
0
votes
2answers
703 views

How to get thumbnail from post attachment in this loop

I use this code to display Most popular posts based on view count, but I dont have images in post content I have all images attached to post via attachment (gallery) How to replace this "thimthumb" ...
0
votes
1answer
24 views

WP_Query for attachments without duplicating post_parent and displaying tagged image

I've tagged a number of media uploads on my site with the various products' names which are featured in them. The goal is to get a list of the posts which have been tagged with each product name, but ...
0
votes
1answer
1k views

Let users upload image(s) to the post from front end

I want to enable logged in users (Wordpress) to submit posts from front end (among with other data). My form is working great, I add custom post meta data which I later display on custom post page. ...
0
votes
1answer
417 views

Attach images to posts using custom fields (just paths to images already upld)

I'm setting up a real estate website, which i make listings using a custom post type 'listings' in which I have multiples metaboxes for beds, baths, and all other informations. I use a plugin to ...
0
votes
1answer
419 views

wp_query for displaying attachments with a tag

So I am running the following query: <?php $args = new WP_Query(array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'oderby' => 'title', ...
2
votes
1answer
401 views

How to grab the first two image attachments from a post?

I am grabbing an image that is uploaded to that post working with this function: wp_get_attachment_image_src <?php $images = get_children( array( 'post_parent' => $post->ID, ...
0
votes
1answer
19 views

What's the database relationship between a post and its attachments

I'm creating a custom import script to migrate CSV data into wordpress. Each post has a series of attachments that must come with it. Following chapter 14 (importing via a custom mysql script) in the ...
0
votes
0answers
7 views

What should the WXR look like when importing non Wordpress content and related images into wordpress?

I'm migrating data from a static website into wordpress. The data from the static websites has been scraped and included in a CSV file along with urls to the links that represent the photos for the ...
0
votes
0answers
8 views

Deactivate url on attachment item

I have a little question for you.. On my website, in the last step when the image from attachment it's on the big size, i want to remove the link from it because on click redirect the visitator to ...
0
votes
0answers
9 views

only first caption showing for attachment in Wordpress

ok I'm using the below code to generate caption for my attachments. The problem is if I have multiple images in a single page, the caption for first image shows for all the images. like if I have ...
1
vote
1answer
43 views

Display attachment resolution size

Seems rather easy, but there is no article I can find on the web or in Wordpress about it. How to simply display (in the current post) the full image size (of the attachment), in pixels? thank you
5
votes
3answers
2k views

Delete original image - keep thumbnail?

I'm using a lot of thumbnails but never the original file. To save space, I'd like to prevent the original from being saved on disk but only keep a thumbnail of 100px. How can I do this? Thanks, ...
0
votes
0answers
66 views

How do I get attachment_id?

This is trivial, but I can't really find an answer, I've seen some hints like search in database etc., but this is madness. Basically, I have a metabox with upload button that allows you to upload or ...
0
votes
2answers
447 views

After changing permalink structure, How to redirect attachment url to old parent post url

I change my permalink structure successfully. /%year%/%monthnum%/%postname%/ --> /%category%/%postname%/%post_id%/ But now I face a problem. Before change my permalink, I redirect my ...
5
votes
1answer
4k 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
1answer
281 views

How to change image url?

How can I change the image url from this http://i0.wp.com/example.com/wp-content/uploads/2014/06/imagename Into this: http://www.example.com/image/imagename.jpg Or into this: ...
0
votes
1answer
274 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
1answer
55 views

Making images from single.php pointing to an attachment .php template

I am trying to make the inserted images from a post (single.php) to point to (single-attachement.php) an attachment page. So far I checked a post here on stackexchange and added this code on the top, ...
2
votes
2answers
253 views

Find first image on paginated post for Pinterest

I've been looking for days, yet can't find a good answer. Perhaps the SE crowd can be of assistance. Any help is much appreciated. I am using a custom-coded pinterest button included on posts that ...
0
votes
0answers
10 views

Bad attachment links (starting with “../wp-content/uploads”)

For some reason, WordPress is generating attachment images with bad links (beginning with a relative call, which breaks with prettified URLs). The links begin with "../wp-content" - and I can't figure ...
0
votes
0answers
26 views

Get URL value from 'ATTACHMENT DISPLAY SETTINGS'

How do I get the URL from the 'ATTACHMENT DISPLAY SETTINGS' > 'LINK TO' secion of the media upload when listing attached images using the following code. <?php $args = ...
5
votes
6answers
7k views

Disable image attachment links

Is there a way to disable image attachment links trought a filter in functions.php or something ? I know it's possible to do it manually when you add an image to a post but I want to disable this ...
0
votes
0answers
9 views

Attach previously uploaded file to post

I am working on a script to upload data to a create a post with an (already uploaded) file attached. The file is located in the wp-content/uploads folder, but not added to the media array. How could ...
0
votes
1answer
34 views

the_content() behavior on attachment.php versus single.php

I'm having some trouble getting the_content() to work on attachment.php. I have a template page that has the basic loop and simple calls the_content() in the loop to display the post. Scenario 1 ...
0
votes
1answer
21 views

Open image size links in a page instead of direct image link

I am using this custom function to display image sizes on image.php (attachment page) function my_get_image_size_links() { /* If not viewing an image attachment page, return. */ if ( ...
0
votes
1answer
43 views

loop through posts and display inserted media and post title as a link

I'm fiddling around with an issue I cannot solve. Inside the loop I would like to find the URL of an inserted media file (pdf, doc etc) and display this as an anchor. Furthermore I would like to ...
1
vote
2answers
417 views

Disable edit media attachments?

Looking for a way to disable the "Edit Image" option. I would still like to be able to edit the description, alt, etc. But remove the Edit image button or disable that image editor. Thanks,
0
votes
1answer
213 views

How do I delete thousands of unattached images?

I have thousands of unattached images with no files. How do I delete them all quickly? ls: cannot access wp-content/uploads/2014/09/jeep cherokee patriot-Ekza.jpg: No such file or directory
0
votes
1answer
83 views

How to send email in wordpress with more than one attachments

In my plugin, there is a contact us form through which users can upload multiple files and it will be uploaded into wp-contents/uploads/2014/10 folder. Uploading is working, but now I need to send ...
0
votes
0answers
46 views

Setting image attachment caption, description, and alt text programatically

In an attachment post, which post fields correspond to the attachment's caption, description, and alternative text. I cannot find any documentation on this relationship, and I am trying to get ...