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

1
vote
2answers
221 views

Image Gallery Numbers for 3.5

In previous installations of WordPress it was possible to number images in attachment.php using the code below, which was originally provided here. However, I'm finding that this code no longer works ...
1
vote
2answers
565 views

How can I attach hotlinked images in posts/pages within the same server?

Not sure if this makes sense but I'm trying to attach hotlinked images to their posts/pages with no lucky, most plugins such Cache images works ok but only to external domains, I need to auto-attach ...
1
vote
1answer
361 views

Multiple images in one attachment page

I want multiple images for one post attachment page, but there is no option for that. How can I do that?
1
vote
1answer
264 views

Don't show attachments if they are inserted in post

I have attached images that I have inserted into my posts but they also appear in the attachments box at the bottom of the post. I'd like to know how to make them not appear in the attachments box if ...
1
vote
1answer
505 views

How to delete all post and attachments of a user when I delete it?

When I delete a user, WordPress can just delete the post or page of this user, not his custom post and his attachments. An idea for a special hook? add_action( 'delete_user', 'my_delete_user'); ...
1
vote
2answers
453 views

Wordpress Image Attachment using remote image

Is it possible to use remote image as wordpress attachment? * Not stored on our server.. How about the code/script? i see that attachment is act as post in database.. seems it's possible. UPDATE ...
1
vote
2answers
216 views

Allowing post attachments without allowing to insert in text

Is there a way I can allow the user to attach images as attachments to a post without allowing him to insert them within the text itself? Ideally the Upload Media button remains the same but the image ...
1
vote
2answers
233 views

Getting the ID of any image for use in functions.php

I've added two custom fields to attachments on my site, so the user can add a special image credit. I'm trying to write a function that looks to see if either of the custom fields are populated, and ...
1
vote
1answer
78 views

Where does the gallery shortcode gets its attachments from?

I know that media are an attachment post type that are children to a post, but how are galleries stored in WordPress?
1
vote
2answers
359 views

Validate data on attachment_fields_to_save

I'm very glad that there is such a dedicated website for WP. My problem is data validation upon saving attachment fields. I have added many custom fields to attachment/media library dialog, most of ...
1
vote
1answer
421 views

Set attachment tags from attachment's custom field data

I currently have a custom field added to my attachment's form called artist_credit using the hook attachment_fields_to_edit. When a person enters a name into the artist credit field, I want it to (if ...
1
vote
1answer
641 views

How to protect post attachments related to a custom post type, from non-logged in users, on 1 subsite of a multisite installation?

I'm developing a simple "member's only" section within a website, with the sole intention of allowing the client to post files for their members. I've come to realize quickly that the posts' ...
1
vote
1answer
433 views

Exclude images from “inserted into post” when trying to get attachments

I have here the coin-slider which takes all pictures from the gallery. I get the attachments through the following code: $attachments = get_posts(array('post_type' => 'attachment', 'post_parent' ...
1
vote
1answer
277 views

What is the “icon” parameter in wp_get_attachment_image_src used for?

On the reference page for wp_get_attachment_image_src, there is a parameter called icon and it only says: $icon - (bool) (optional) Use a media icon to represent the attachment. Default: false ...
1
vote
1answer
1k views

Creating a multi-file upload form on the front end for attachments

I am trying to create a public form where users can upload multiple images to be attached to a particular post. I am able to get it to work with single images thanks to this post at Golden Apples ...
1
vote
1answer
348 views

Is it possible to list post attachments in a sub URL endpoint with a dedicated template?

Wordpress provides templates for displaying media attached to a post or page (attachment.php and more). They're also displayed with nice permalinks, such as: ...
1
vote
1answer
703 views

Is it possible to Hook/Filters Attachment Creation?

Is it possible to hook or filter the attachment creation process? More specifically is it possible to hook into the attachment creation so that I may parse the attachment’s filename, populate the ...
1
vote
1answer
285 views

Custom field not updating when value is empty

I've added a few custom fields to the WordPress image uploader using the hooks attachment_fields_to_edit and attachment_fields_to_save. Everything works very well, except when a field is erased by the ...
1
vote
1answer
832 views

How to remove attachments size attribute [duplicate]

Possible Duplicate: Prevent Width and Height Attributes in Image Tag Output i would like to remove the width="512" height="128" attributes on an attachments this method is fine on images ...
1
vote
1answer
103 views

media 'path' issue / concern when bringing files live

I'm currently developing a site we have installed on a sub-domain. 'beta.mysite.com' We will eventually, be moving site to it's root domain. 'www.mysite.com' Problem? any post type attachment / the ...
1
vote
1answer
1k views

attachment.php code or tutorial

I am confused about the exact purpose attachment.php ( and image.php) . I notice many themes dont have them. If single.php displays the image the way I want then is it OK to leave it out. On the other ...
1
vote
1answer
315 views

Wordpress adds extra width to post images container boxes

when I insert an image into a post, the <div> that contains that image (and thus any caption) is set to be wider that the image itself. For example, I have added an image that is 211px wide. ...
1
vote
2answers
763 views

How to redirect 'file url' to 'post url' i.e. in attachment.php

I've just started using the attachment.php template on my site. What I'd like to do is redirect all images in posts that used 'file url' to 'post url' and my new attachment.php template. Is this ...
1
vote
3answers
1k views

Control attachments menu order with jQuery Sortable

I've managed create a metabox that lets me upload and then fetch the images and then also been able to add jquery ui sortable to be able to sort the images, however I've no idea how to add actual ...
1
vote
1answer
285 views

Handling image uploads without thickbox

Ideally what I'd like to do is hand a file to a function that returns the file as an attachment of the current post. Just as though it had been uploaded via the thickbox media uploader, but without ...
1
vote
3answers
1k views

Hide “Gallery Settings” and “Insert into Post” button from Attachment window

I'm using different method to form a gallery in Wordpress, so I would like to hide an option to insert images and galleries into post for anyone but Administrator. Can someone show me an example how ...
1
vote
1answer
524 views

get post attachment using ajax

I'm developing a plugin and I'm trying to get the url's from a post's attachments with ajax. If the user is on a single.php page. After some seconds, I'm sending an Ajax request, getting all the ...
1
vote
2answers
235 views

Pull images from the gallery

I am building a template where wordpress is being used primarily as an image CMS, I am pulling the first image from the content section of each post. <img src="<?php echo grab_image() ?>" ...
1
vote
1answer
601 views

How do I modify the “Insert Media” lightbox in the admin to only show media items from a category?

I am attempting to resolve a problem I continue to have with the media library. Essentially, what I am looking to do is "automatically" assign media which is uploaded from a custom post type "edit ...
1
vote
1answer
2k views

Link Attachment Image to Category

How do you link an attachment image to its category? function wp_attachment_image($size = thumb) { if($images = get_children(array( 'post_parent' => get_the_ID(), ...
1
vote
2answers
291 views

Why can't my admin account manage attachments on a custom post type with a unique capability type?

I've created a custom post type called 'directory' and assigned it the capability type of 'listing'. It has a unique capability type because I want to restrict Contributors to only be able to ...
1
vote
0answers
46 views

How to make a customized “Create Gallery” tab in the 'Add Media' window?

I'm developing a plug-in and wanting to make a customized version of the the "Create Gallery" tab of WP v4.0, but have the resulting output (i.e. what gets inserted into the TinyMCE editor) to be ...
1
vote
2answers
208 views

Unable to upload specific .zip file type via frontend in WordPress 4.0

I allow uploading a selected few types of files from the frontend, e.g. .zip, .mp4, .jpeg and .pdf. Till now all these file types had no issues getting attached to the post it is uploaded to. However ...
1
vote
0answers
19 views

Replacing the content of an image attachment using API

I have an existing image attachment, with a given ID. Is there a way, using API (specifically, Python Wordpress XML-RPC), to upload another image instead of the existing one, without creating a new ...
1
vote
1answer
211 views

wp_mail file attachment not being placed in upload folder?

I have a form where I want users to be able to select an image to upload. The image gets temporarily uploaded to the wp-content/uploads folder, is attached to the e-mail and then is destroyed. Right ...
1
vote
0answers
65 views

Clean up images, delete unused image sizes attached to a post type

I found this post: How do I delete all generated images from my server except those currently used in posts which describes how to delete all image sizes but the original uploaded image file. I need ...
1
vote
2answers
66 views

Taxonomy archive + query attachments = duplicate results

I'm trying to get the attachments of a specific term (in its archive page). But the results are showing the resulting images 5 times instead of one. I have multiple loops in this page - one to show ...
1
vote
0answers
49 views

How to limit number of attachments

I'm using Sweet Cake theme. As you can see the portfolio section show all pictures. I want when someone load the site to be displayed items of the first category , instead of everything. How can I do ...
1
vote
1answer
413 views

Return Attachments from Custom Post Type

I'm a fairly new WP developer. I am trying to get my portfolio.php to display all images attached to my custom post type 'portfolio', and then display them in a masonry format. I've managed to get ...
1
vote
1answer
15 views

Is there a move_attachment_file() function in wordpress?

I would like to move (or copy) an attachment from the the "standard" uploads directory to another directory and at the same time make sure all the attachment metadata is updated to reflect the change ...
1
vote
0answers
99 views

Reorder “menu order” of attachments to another predefined order

I want to show photos attached to a post in a gallery using the built-in system with a custom order. Currently with the [gallery] shortcode it is posible to order it by name, by upload date, by ID, ...
1
vote
0answers
31 views

Add an attribute to attachments

Currently attachments have title caption alt text description I would like to add another attribute to that list (e.g source). How can I do this ?
1
vote
0answers
20 views

Delete original attachment files after editing

I am looking to obtain an certain workflow using WP Media Uploader and Image Editor and I am getting a lot of generated images that I do not need and I do not want to keep them. You can see in the ...
1
vote
0answers
105 views

Custom image sizes add to metadata

I want to put resized files in original file metadata. //Original file $aid = wp_insert_attachment($attachment, $file['file'], $post_id); $a = wp_generate_attachment_metadata($aid, $file['file']); ...
1
vote
0answers
50 views

What is the best way to store thumbnails for a non-image attachment?

I'm in the process of extending Document Gallery to support generating and displaying thumbnails for each document. I've got thumbnail generation under control, but I'm curious as to what best ...
1
vote
0answers
114 views

Rename attachment filenames to attachment ID on upload

I have been trying this code out (based on this Change attachment filename ), it does not work properly. For instance, featured image is not being displayed in admin panel single post, neither are ...
1
vote
0answers
26 views

Change default selection for “Embed or Link”?

I want the default ATTACHMENT DISPLAY SETTINGS for media files (not images) to be set to "Link to Media File". I have found update_option snippets for images, but not audio/video. Can't find the media ...
1
vote
0answers
64 views

How can I append custom data to images in the editor?

I've added a custom meta field to my image details so that a client can add a number to their photos (a design choice). The data would need to show up under each image (like a caption) inserted into ...
1
vote
1answer
96 views

How to upload image without post ID using the new media uploader?

In the past when using thickbox to upload images, an image could be uploaded without having the post ID 'attached' to it by simply using the code below : ...
1
vote
1answer
66 views

Can't update old posts 3.5.2

Background: I'm working on a customers site that I haven't build myself. The site works pretty ok, when I got it the wp_header and wp_footer was missing and the javascript files were all linked to ...