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

3
votes
1answer
111 views

WordPress comment count to include attachment comments

How can I make the comment count on a post on my index page include comments that have been made on, in my case, individual gallery pictures that are included in the post? It seems that comments made ...
2
votes
1answer
105 views

Impossible to get Attachments Outside Wordpress?

My page (outside the wordpress install) begins something like this: global $wpdb, $wp_query; define('WP_USE_THEMES', false); include_once 'word/wp-blog-header.php'; $args = array( ...
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 ...
2
votes
1answer
95 views

Converting Attachment to Images?

I've had no problem using lightboxes before with attachment images, but I've switched to a new theme called Quicknote and it seems that attachment images now instead link to the attachment page. ...
1
vote
1answer
12 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
1answer
718 views

How to solve: An error occured in the upload

This error message appears when I try to upload any picture. Currently I am using WordPress 3.8.
1
vote
1answer
60 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
226 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
131 views

problem in uploading attachment to custom directory

i have been trying to upload the attachments to the custom directory without affecting the old uploads. so i use this bellow code to achieve that add_filter('wp_handle_upload_prefilter', ...
1
vote
1answer
916 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: ...
1
vote
1answer
259 views

How to set a default meta value for custom field

I have setup a custom meta_key for attachments. Since it is a radio button with Yes/No options, and the default value is always Yes, I need that this default value is saved into the db when the ...
1
vote
1answer
111 views

Add attachment for all images in post

I want to move someone else's WordPress blog to a new server. I only have access to the exported XML file of the blog. When importing the XML with the Wordpress Importer plugin, everything went fine ...
1
vote
1answer
332 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
13 views

How can I return multiple image attachments with wp_get_attachment_image_src

I want to return multiple image attachments to my template landing page, but wp_get_attachment_image_src only returns the first image attachment. How come? Thanks in advance <?php /** ...
0
votes
1answer
34 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
30 views

Media/attachment urls don't redirect with fake URL structure

I'm having an issue with media/attachment files and I'm not quite sure how WordPress is returning the URL that it does. I've noticed that I can add anything as a subdirectory structure before a media ...
0
votes
1answer
13 views

How can I hide previous_image_link() on first attachment page?

I'm using previous_image_link() and next_image_link() to show thumbnails in my image.php template page. I'm surrounding the thumbs with some styling, so need to be able to hide the whole previous ...
0
votes
1answer
32 views

Attach an image to new posts

I am trying to attach an image to the body of a post. The post is created. The image is added to the Media Library. The thumbnail is added to the post. The images do not get added? $attachment = ...
0
votes
1answer
49 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
1answer
48 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', ...
0
votes
1answer
75 views

How can i catch (with get_posts) attachment file (pdf, images) from a post when i have only inserted it from media library and it isn't upload for it?

I'm sorry for my english. I discover a strange behavior in WP get_posts when i try to detect from a post an attachment (in my case a pdf file) inserted from the library. This is my code: ...
0
votes
1answer
109 views

Use the WP media uploader dialog for uploading a form attachment (non-admin). Offering progress and drag and drop feedback

I am building a simple contact form (non-admin) that has an attachment field. Of course I can just handle the upload via WP's wp_handle_upload function. However, I would like to give my visitors a ...
0
votes
1answer
118 views

Correct Syntax for uploading files to custom directory in Wordpress

I have current PHP code that works when attaching files on a form. The files have to go to a certain directory. I know that while attaching in Wordpress I need to use a different syntax. However, I've ...
0
votes
1answer
75 views

How to retrieve “custom url” from image attachment in wordpress

I have uploaded a bunch of images to a post and set the 'custom url' for each of them in the media uploader. How can I retrieve the custom URL assigned to each image into $caption_text= at the ...
0
votes
1answer
106 views

Unable to get wp_get_attachment_url to show

I'm trying to show a link to the full size image of an attached image. I took a code for Wordpress' Twelve Thirteen theme: <?php $metadata = wp_get_attachment_metadata(); printf( '<span ...
0
votes
1answer
62 views

Possible to “Attach” images to multiple posts without uploading twice from Add media Section?

How can I attach images to a post which have already been attached to other posts without having to upload them twice? I don't want to insert the images into the post, I simply want to attach the ...
0
votes
1answer
78 views

Remove attachment from database

Is there a way to bulk remove attachments from WordPress database but not delete the actual files from the server? Sort of like the opposite of http://wordpress.org/plugins/add-from-server/
0
votes
1answer
84 views

save_post not working with attachments

I've made a Meta Box for Posts and Pages, and while testing added Attachments too. But, curiously, the hook save_post does not fire. $cpts = apply_filters( 'my_filter', array( 'post', 'page' ) ); // ...
0
votes
1answer
87 views

Retreive tags from attached post for media on page

I am working on a custom template file that pulls all images in my Media Library with a specific tag. I was able to get this working with some help from the community, it also shows the title of the ...
0
votes
1answer
101 views

Post images not displaying as attachments

I am trying to display the images attached to a post in single.php I've used : <?php if (have_posts()) : while(have_posts()) : the_post(); ?> $args = array( 'post_type' => 'attachment', ...
0
votes
1answer
44 views

Show title when inserting single images

I just can't get how to do this. When inserting a gallery I have this output: <a href="path_to_files/image.jpg" title="fancy title"> <img width="150" height="150" ...
0
votes
1answer
43 views

Move caption in on attachment page

I am looking for a way to edit the way Wordpress’ native gallery displays images when clicked on. Specifically, I need to move the title below the image. A more detailed explanation: I setup a ...
0
votes
1answer
88 views

list of attachments: wp_get_attachment_link works, wp_get_attachment_image does not

On single.php theme template file, I'm displaying the post's list of attachments. global $post; $args = array( 'post_type' => 'attachment', 'numberposts' => null, 'post_status' ...
0
votes
1answer
145 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
0answers
49 views

How to create attachments page template switch?

I've read several post over this topic, however, none have provided me with an answer. Firsly, let me say that I'm a noob in php programming, but I managed somehow to rewrite my html site to wp theme. ...
0
votes
0answers
38 views

Moving from a multisite development site to a new non-multisite server, Can't import media successfully

After developing a website on a multi-site setup, I'm now making the website live on a single wordpress installation on a separate server. I'm trying to import my content using the wordpress ...
0
votes
0answers
15 views

Fetching attachment_link outside loop

First of all I must say I'm not a star with PHP. I have registered here because there are so many good solutions to stuff I needed in the past, so thought it would be good to try and engage in the ...
0
votes
0answers
59 views

Failed to load the image url from using another database

this is the site to display the images I have created the two websites. The main website having common database for both. In main site the is no problem it will display the images but here i am using ...
0
votes
0answers
63 views

Download Count Each File

I need help on how to show download hits in my WP website. I got lot of PDF file, each are in single post (User upload files via custom field). I want to show something like: DOWNLOAD 31.3mb - ...
0
votes
0answers
143 views

display image attachments in slider

I am trying to add a custom portfolio to my website and what I'd like to do is have an image slider where the user can navigate through all the images of each artwork. So far this is what I have, but ...
0
votes
0answers
48 views

“attachment” default rewrite rules disappeared!

something very strange is going on with a WP theme I'm developing. The set of default rewrite rules regarding attachments .+?/[^/]+/attachment/([^/]+)/?$ .+?/[^/]+/attachment/([^/]+)/trackback/?$ ...
0
votes
0answers
49 views

Wordpress gallery image link gives 404 when not logged in

I'm attempting to use the default Wordpress gallery (from the post editor 'Add Media' then 'Create Gallery'). When logged in as an admin and clicking an image in the gallery on the resulting blog ...
0
votes
0answers
27 views

How can I create an edit media thickbox link?

After uploading an image to a page or post, you can click an icon/link in the top left corner to open a thickbox editor and edit its properties at any time. I have a a situation where I am uploading ...
0
votes
0answers
137 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
0answers
88 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 ...
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
0answers
243 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
0answers
61 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 ...