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
119 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
136 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
233 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
109 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
16 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
154 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
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: ...
1
vote
1answer
121 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
402 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
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
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 ...
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
1answer
21 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
1answer
44 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 ...
0
votes
1answer
44 views

wp_get_attachment_image_src always returns false

I'm using wp_get_attachment_image_src to retrieve image URL. Codex is simple for this function and starting from an ID on my database I used wp_get_attachment_image_src in this way: $image_url = ...
0
votes
1answer
47 views

Need to get array of images ID attached to post

How can I obtain ID of images attached (and not necessarily inserted) to a custom post type ? I want to pass this argument in order to use this images in soliloquy slider
0
votes
0answers
35 views

Create a constant download link that always points to latest attachment

I plan to have one attachment per post and the attachments will often be receiving updated versions with different file names. I have an issue where users copy and paste the file url and send it via ...
0
votes
0answers
23 views

How Do Set image Folder For generated thumbnails with wp_generate_attachment?

I wrote an import app to create posts with several attached images. The files are already on the server under wp-content like so: wp-content/mygalleries/gal_a wp-content/mygalleries/gal_b ...
0
votes
0answers
84 views

Some images not being returned with wp_get_attachment_image

For some reason this code works on my local copy of a wordpress site but the live site is not working. // WP_Query arguments $args = array ( 'post_type' => 'post', ...
0
votes
0answers
34 views

How to store and retrieve the attachment alignment?

I am working on a project, where I want to display all image attachments of a post. Getting the URL and size of the images is not a problem, since both get stored in the database, if the image gets ...
0
votes
0answers
28 views

Change only the attachment permalinks to %post_id%

My permalinks are set to /%category%/%postname%/ but I would like attachments to live at photo/%post_id%/ I already have a rewrite function to change the attachment slug from attachment/ to photo/, ...
0
votes
0answers
111 views

Attaching images on frontend with AJAX to show thumbnails before submitting form

I currently have a frontend post upload form working so that users can add thumbnail attachments to a post, however it isn't possible to see which thumbnails you have attached before you submit the ...
0
votes
0answers
193 views

How to attach image to custom post type

I am using this answer to upload files in my custom post type meta box. How do I attach the actual attachment post to parent post(custom-post-type), so that in wordpress admin, I know that the image ...
0
votes
0answers
19 views

Change default options on attachment page

I'm currently adjusting someone's plugin, and they're pulling data from the attachment page. Rather than edit the whole plugin entirely, I'm after a quick fix. Is it possible to change the wording on ...
0
votes
0answers
115 views

How to include editable PDF in wordpress

I need to include a Existing PDF in website, where user can either fill or download it. I tried to use visual form generator, but it doesn't like actual form and I need to allow a user signature. ...
0
votes
0answers
39 views

Incomplete attachment page

I am using the twenty-thirteen theme and my attachment page chops off the footer & image. Have a look at my screenshot. You can see that it shows the title but it doesn't show the image and the ...
0
votes
0answers
44 views

Lots of attachments is causing slow load

I have a wordpress site with 400k unattached images. When I try to view any single attachment page it loads quite slow. Is there anyway to improve performance?
0
votes
0answers
56 views

All images from posts of specific category

I'm photographer and am developing my own portfolio, it's in the final stage. I'm trying to get all images from posts in a specific category. I can actually get all images from all posts, but they ...
0
votes
0answers
76 views

How to show post attachment image

i am going to create a slidershow by post attachment in single.php. i use this code but the result is null. <?php if ( have_posts() ) while ( have_posts() ): the_post(); ...
0
votes
0answers
48 views

Remove link to post thumbnail in next_image_link() in single-attachment.php

I've added navigation to single-attachment.php: <div class="navigate"> <div class="previous"><?php previous_image_link( false, '&nbsp;'); ?></div> <div ...
0
votes
0answers
14 views

Attaching a media file to email link from webpage? How?

When someone clicks a link on my webpage I want it to come up as an email with a document from my media folder already attached to it. How do I do this? Thanks!
0
votes
0answers
100 views

Password protected category based attachment/media list?

I am working on building a custom template, and I'm running into some trouble using the password protected feature for wordpress pages. Basically, the content from the page I have published and set ...
0
votes
0answers
538 views

Set thumbnail from URL, by grabbing image in functions.php

So I've written a whole bunch of functions, which are used to display Vine videos. I then have a shortcode which outputs the code. The last thing I have to do is set the post thumbnail. I want to be ...
0
votes
0answers
32 views

Drupal 6 to Wordpress migration - media attachments

Migrating was simple with a few SQL queries that I found on a blog. But I was unable to find a way to importing images as media attachments on the Wordpress site. Any help is really appreciated.
0
votes
0answers
99 views

Advanced Custom Fields: wp_get_attachment_url not working, attachment page says “Missing Attachment”

I used Advanced Custom Fields to add a file upload field to a custom post type. I have the following code in the template for this custom post type: $file = get_field('file'); echo ...
0
votes
0answers
35 views

How to force attachment size for every post

I created a custom size like this : add_image_size( 'my-size', 615, 9999 ); Is there anyway i can force the ATTACHMENT DISPLAY SETTINGS SIZE to be always ('my-size') for every attachment?
0
votes
0answers
73 views

How to set/force the size of the image/attachment uploaded by frontend form?

I have a front end form to let users upload images to my website and i set the post attachment image like this: // find the most recent attachment for the given post $attachments = get_posts( ...
0
votes
0answers
9 views

Permanent names of attached files required

Simple: How to delete uploaded file ? Secondary: How to replace uploaded file and to keep its filename (inclusive the path) and all links (inclusive on the whole internet!!!) the same?
0
votes
0answers
130 views

How to search attachments (images) and posts in WordPress of a given post type

I'd like to extend the search functionality in a WordPress blog in order to search a custom post type including its attachments. I got some progress searching posts and attachments, also excluding ...
0
votes
0answers
69 views

Attachment Metadata not updated while uploading audio files

Suddenly, I am having some issues when uploading audio type of file in wordpress. previously, when I uploaded .mp3 files, the attachment metadata of the files were updated accordingly, for instance; ...
0
votes
0answers
22 views

Is there a way to add Reattach and Unattach links in image gallery?

For some reason the Reattach and Unattach links in Media library is gone. Is there a way to add these from functions.php?
0
votes
0answers
251 views

Prevent Duplicate Attachment When Using wp_insert_post

I am trying to use wp_insert_attachment while using wp_insert_post. It's successfully creating the post and attachment. It have no problem if I only use the wp_insert_post function, but when I ...
0
votes
0answers
35 views

Limit number of uploaded attachments of specific context

I am assigning a custom _wp_attachment_context meta to attachments with specific usage. In my case - favicons. I also took advantage of the WP Customizer so my users could upload icons using extended ...
0
votes
0answers
269 views

A attachment file with a php form in wordpress?

I am making a PHP form in WordPress. I would like to receive a notepad or PDF file along this form when user submit form. I am getting all this in email using mail function in a body variable for ...
0
votes
0answers
95 views

List Post Attachments Conditionally Based on File Name

I am trying to display the attachments of a custom post type based on their file name (numbering at the end) and then assign it to a title. I have 10 pre-defined titles that I want to link to a ...
0
votes
0answers
68 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
209 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
394 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
67 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
102 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 ...