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
6 views

Insert Media - Attachment - Link to : Remove the “attachment page” option

I want to remove the attachment page option from the attachment's link-to selection. I don't always want to tell my clients to avoid selecting this option, I simply want to take it out. But I am not ...
0
votes
1answer
22 views

How to link images to attachment.php [duplicate]

I have custom attachment.php, I want to give link for images in single.php so if user click that images, will redirect to attachment.php is that possible? Here is the example of code. <a ...
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
14 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 ...
3
votes
2answers
36 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?
0
votes
0answers
27 views

Change default URL of image attachment

I have only one image attachment per post, as featured image. Every post have just one image, featured image, and no any other image in post content. By default URL of image attachment is: ...
0
votes
0answers
10 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: ...
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
26 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
22 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
8 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
0
votes
0answers
73 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
1answer
65 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, ...
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
27 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 = ...
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
35 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
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
222 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
84 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
47 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 ...
0
votes
0answers
28 views

Custom wordpress media upload tab with the attachment browser

I've managed to add a new tab to the "Add Media" window with the help of this answer. Now I'm trying to add a custom gallery type in this tab. I'm trying to add the default attachment browser in this ...
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 = ...
1
vote
0answers
64 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
1answer
68 views

How to remove images from showing in a post with the_content()?

Trying to learn more about creating my own themes and not using any plugins I wanted an ability to display all the images in a post excluding the thumbnail in my single-foobar.php file and I can do ...
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
1answer
13 views

controlling whether upload is attached to post or not

I'm using the new (3.5+) media upload API to open a media modal dialog from a post meta box, and select a file from the media library (as per ...
0
votes
0answers
27 views

attachment custom values are'nt inserted to database

I have created attachment custom field. After I uploading image and inserting to new-post.php (post creating window) no meta values are saved in database. Even that I have set a default value for ...
0
votes
1answer
58 views

How do I add Facebook OpenGraph meta tags for attachments in the header for a custom theme?

How do I add Facebook OpenGraph tags in the header when the header has already been called, and the values I need to add are obtained in the body? This is a highly customized theme (which I did not ...
1
vote
2answers
301 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 ...
0
votes
1answer
116 views

How to allow specific extensions and file size to wp_mail attachment?

I am trying to create a form with an attachment option that will be sent to an email when the form is submitted on a wordpress site. My codes work fine and it sends email in a HTMKL table format to ...
0
votes
0answers
15 views

Media uploader edit image direct in edit-psot view

I want to make available to edit custom fields (its gallery) direct in edit-post view. Im using ACF plugin so I have this view: http://grabilla.com/04906-95db6a64-4c3f-497a-b312-67fff32ab21f.html I ...
0
votes
0answers
14 views

How can I show errors in the “Add Media” iframe?

I've added a custom field to the "Add Media" form using add_filter('attachment_fields_to_edit', ...) and I'm validating the existence of it when saving the attachment fields using ...
0
votes
2answers
28 views

Conditional tag for attachment posts

In Wordpress single.php post pages are both for media attachments (e.g. http://domain.se/postname/imagename/) and blog post pages. What conditional tag can I use to determine if a post is not a media ...
6
votes
2answers
262 views

Is it possible to query all posts that don't have an attachment?

I want to get a list of all posts that don't have an attachment and delete them. This question takes about getting all posts that have an attachment, but I want the reverse of it. The brute force ...
0
votes
0answers
49 views

Remove attached media

I've created a custom Page Template that grabs all the attached media (images) to the page using get_attached_media(). I'm adding the media by clicking on Add Media button above page title. If I ...
1
vote
1answer
64 views

Show attached media image if no thumbnail image detected

I use the if ( has_post_thumbnail() ){} to check if the post have thumbnail image, but this echo get_attached_media('image', $post->ID); displays the word Array I need to show the ...
1
vote
2answers
67 views

How to add a rel attribute to images that contains their categories?

I've added categories to images, so that I can use them to filter images within a portfolio page. Now I'm thinking I need to add the rel attribute to each image that contains its assigned categories. ...
0
votes
0answers
59 views

All post attachments in gallery grid to full screen slideshow?

Using the default wp gallery for displaying the attachments. All attachments for the specific post in full screen slideshow when click on image. I am using also Bootstrap frond end framework. Possible ...
0
votes
1answer
13 views

Differentiate attachment pages in search results

I'm using the Relevanssi search plugin, which is basically a better version of the default search. Anyway when I search for something it displays everything I need it to, I was just wondering whether ...
0
votes
0answers
30 views

Display further content in file media attachment

When i see the image attachment in full size I need to show text in wp-content/uploads/2014/08/filename.jpg. Also I need to show go back button, and others info about the image opened in full size. I ...
0
votes
0answers
5 views

I want to display tag description and tagged attachment (without post if there isn't..) while using tag url

I am new to coding, but i do understand a little bit. Is there a way to edit tag.php to achieve this? I have added Shiba media library plugin to my site so that i can add tags and catagories to ...
0
votes
1answer
133 views

attachment.php & flexslider—linking thumbnail to specific image

I am nearly there but need the help of the community to bring me home! I am linking from a "gallery overview" page (thumbnail grid) to a single, full-size image page (attachment.php) containing a ...
0
votes
0answers
43 views

Attachment doesn't display post_parent gallery in multisite

I am working on multisite in a subfolder. I create a post with image linked to "attachment page" and not to a "media file". If the post has one single attachment and if i click to this image ...
0
votes
0answers
25 views

Image path in posts (/uploads/yyyy/mm) does not match actual file location

I just moved to a new server and upgraded WordPress as well. Somewhere in the process my image paths in old posts got mismatched to the actual file location. All the old images are now broken. As an ...