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
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.
0
votes
1answer
14 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
1k 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
0answers
21 views

Change the Permalink for wordpress attachment

My attachments are currently rewritten from http://localhost/?attachment_id=3 to http://localhost/images/image-title using @Bainternet's answer here. $new_rules['images/(\d*)$'] = ...
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: ...
5
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
1answer
227 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
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. ...
3
votes
3answers
482 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' => ...
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
26 views

Replacing all attachment links in post with media file link

I'm working on a Wordpress site, where all images inside posts are linking to the corresponding attachment pages. I want to use a lightbox but obviously this would require changing all the links back ...
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
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
2answers
642 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" ...
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 ...
3
votes
2answers
1k views

wp_generate_attachment_metadata gives me an empty array

I have a custom post type and a metabox with a file input. I can insert the attachment, but I can't update the attachment metadata and I don't know how to fix it because I don't receive any error. ...
0
votes
0answers
44 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 ...
1
vote
2answers
22 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 ...
4
votes
1answer
839 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.
1
vote
0answers
31 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
26 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 ...
0
votes
1answer
296 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 ...
2
votes
2answers
2k views

How can I hide media library images from general users?

As an admin I really like the features and functionality of the WordPress 3.5 media manager. With a multi-user site however all users can see all images in the media library - whether uploaded by ...
0
votes
1answer
23 views

Setting name of attachment URL

I have a problem I need to fix with the URLs that are generated for the attachment pages of images with metadata. I’m working on a photography site where individual photos are displayed as ...
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
3answers
2k views

How can I get a different image size, if all I have is the link?

For various reasons, I can't use Wordpress' built-in Thumbnail functionality. What I want to do instead is to use the first image in the post as the thumbnail. Here's what I found in the codex: Show ...
0
votes
0answers
16 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
2answers
38 views

Get attached media only

I am using wp_query to get uploaded medias. Everything is working fine, but wp_query will return the medias with no post attached. This is not what I wanted. How can I exclude the unattached media ...
1
vote
1answer
69 views

Add an image gallery to a custom post type?

I am pulling data from an external web service into a custom post type. This data includes images. How can I create an image gallery, add some existing attachments to it, and associate it with a post? ...
0
votes
1answer
29 views

Save attachment ID instead of URL in custom field

I am testing several frameworks (currently Vafpress) to help me creating custom meta boxes. I need to save a lot of attachments with my posts but noticed that the attachment is saved with its full ...
0
votes
1answer
14 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 ...
2
votes
1answer
523 views

Get attachments (get_posts) and WP 3.5 new uploader

I'm using get_posts() to get attachments from the post and use it in the slider. The issue is new uploader doesn't have that "Gallery" tab which was perfectly suitable for this. It also seems to be ...
0
votes
1answer
407 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
34 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
29 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
34 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
23 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
2answers
298 views

filter get_children to return all mime types EXCEPT 'x'

Like it says on the tin - Im trying to create a list of post attachments that includes everything except say audio, which I'll feed into a player instead. The filter needs to be generic: 'audio' ...
0
votes
3answers
199 views

Calling a javascript function in post edit page after attaching something to post

I would like to call a javascript function after user attaches something to post. I hooked the add_attachment hook, and processed what I want. However, how can I call a function in a Javascript loaded ...
0
votes
0answers
15 views

How show image upload whit guest in single post? [duplicate]

I use this code: function.php function insert_attachment($file_handler,$post_id,$setthumb='false') { // check to make sure its a successful upload if ($_FILES[$file_handler]['error'] !== ...
0
votes
1answer
14 views

Delete attachment with post

I'm trying to post a delete Link for a user so he can delete his own entries: global $post; if ( !current_user_can( 'delete_bkroadkill', $post->ID ) ) return; $link = "<a href='" ...
3
votes
1answer
71 views

Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?

I am looking for solution to auto delete images of old posts in WordPress site. I want to hold images of current 50 posts, others should be deleted automatically. It can be function to delete on time ...
1
vote
1answer
51 views

How to get attached file in wordpress from custom post

I am using the Download monitor plugin I am listing the posts by category the following way $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); <?php ...
0
votes
0answers
42 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
23 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
2answers
38 views

Short of raw SQL, can I query for multiple attachment metadata that have a given array key?

With raw SQL through $wpdb, I believe that I could do something along the lines of this (untested): SELECT post_id, meta_value FROM postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value ...
1
vote
3answers
55 views

File upload, uploads only file name

I am working on a simple front end image upload in Wordpress. With this piece of code I can upload to the wordpress media section but I only upload the name and url of the file then, no image. Does ...
0
votes
1answer
37 views

Importing Attachments with No Extension

Is there an extension, or a technique, during Wordpress import to pull in an attachment URL that doesn't have a file extension? I'm trying to import a Square Space blog into Wordpress. Most of the ...
0
votes
1answer
15 views

What is the best way to associate multiple images to one page?

WP has one major problem and that's image handling. Each image is treated as a post and if you "attach" an image to a page, you cannot un-attach it. Without installing a gallery plugin and without ...
1
vote
1answer
517 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 ...