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
0answers
8 views

Images attached to posts from library link to 404 error page

Just building a theme but I am stuck with attachment images. When I add images from the library to posts (or pages) and link them to the "attachment page" I get a 404 error. The link is like ...
0
votes
1answer
16 views

Could not get attachment using wp_mail

I am trying to create a form which can be sent by users with an attachment. The form works fine and sending the emails when it is submitted but without the attached file. my form is : <form ...
-1
votes
0answers
14 views

Having Issue On Metabox Gallery and Attachment URL [on hold]

Using WordPress 4.5.2 , I am trying to add Gallery Metabox to post using this solution but in js part I am getting this error Uncaught TypeError: Cannot read property 'url' of undefined on ...
0
votes
0answers
16 views

Exclude Featured Image Attachments from Wordpress Search Results

I'd like my search.php page to show all attachments except featured images (because they appear as duplicates of the posts that use them). I have seen some examples that do this for a query, but ...
-1
votes
1answer
16 views

Receive attachment mail in contact form 7 plugin in Wordpress using tag: <input type=“file” > [closed]

I want to know this if someone can help me. How can I Receive attachment file in contact form 7 plugin in Wordpress using tag: input type="file" in the form panel code. this is the code I put in ...
0
votes
1answer
22 views

How to get the filename from file system and create a download link?

I have a custom page template. This template have a custom form, the user can upload a file in that form and input his/her personal infos. The file will save in the file system. I want to create a ...
1
vote
0answers
20 views

Posts and Attachments with “Published” status in Search

I would like the search to show only published posts and attachments (the attachments are photographs taken directly from the media library). The trouble is, when I specify that the post_status must ...
1
vote
1answer
18 views

Wordpress Search Results for Multiple Post Types

I want to show both posts and attachments in the search results. Basically, I need something that says if the post has a thumbnail, show it. else show the attachment image (since they don't have ...
0
votes
1answer
17 views

How to set an attachments parent post id in code?

I've inherited an imported wordpress site with a few issue. I have a list of attahment ids and post ids but I need to re-connect them in the code. I've got a list of all attachemnt like this: ...
0
votes
1answer
37 views

Get Attachment Category Name

How can I call the name of an attachment category? Something that would look like <?php get_attachment_category_name ?> or $attachment->category_name This would simply output the name of ...
0
votes
1answer
21 views

Attachment Metadata inside of Loop

Basically, I'm trying to call attachment info to display withing a loop, for use in an image gallery. I know I need to use wp_prepare_attachment_for_js($attachment_id) but I can't seem to get anything ...
1
vote
1answer
14 views

Attachment changing page's permalink - $post not resetting?

I have a function that I use to populate from checkboxes on a page's edit view (post.php?action=edit). I call this function when I render a metabox on the editor page. function ...
0
votes
2answers
29 views

Using $_FILES variable into the same function for uploading images and files

I want start saying that I'm learning and I'm trying to understand the use of $_FILES and $file_handler which are making me crazy into this function to upload attachments from a frontend form. What ...
0
votes
2answers
39 views

Upload images and attachments from frontend form

I'm not very expert of wordpress and I'm trying to create a frontend form sending information to my php function through ajax. I'd need help about uploading images and files as attachments of the ...
4
votes
1answer
51 views

Validate alt text for attachments?

How can I require users to enter alt text when adding attachments? Alt text is surprisingly buried; the only way I've been able to retrieve the alt text at all is via the wp_get_attachment_image() ...
0
votes
0answers
18 views

Encoding error when importing blog to new website

when I import my old blog (OLD) content to a new website (NEW), it messes up the file names in the uploads folder (more specificaly, it turns images containing special characters like ...
0
votes
0answers
10 views

Basic HTML visual editor for image captions

So, Wordpress 3.4 and beyond now allows html within the Caption field of an image. However, there isn't the basic visual html editor attached to the field. Is there a way to turn on the basic html ...
0
votes
0answers
6 views

Change permalink to attachment gallery post and redirect parent post

I have a problem with the photos attached to another article Example: **Photo1** attached in MyPost1 **Photo2** attached in MyPost2 **Photo3** attached in MyPost2 **Photo4** attached in MyPost3 ...
0
votes
1answer
20 views

Attachments plugin cannot click media library button [closed]

I have installed the Attachments plugin (version 3.5.7) to upload multiple images to a post in my post type 'shop'. The problem: For some reason I cannot click the insert button of the media library ...
0
votes
1answer
19 views

Help to upload post attachments from Ajax

My problem is that I cannot upload post attachments from a frontend form. I send data through AJAX to my php files containing functions. Let me be clear: everything is working great, the post is ...
1
vote
0answers
26 views

Get attachments for posts that belongs to a specific category

I am trying to get images which are used by a post belonging to the specific category. For example if I have plants, mushrooms and animals as post categories, I only need to retrieve images that are ...
0
votes
0answers
10 views

find uploaded files withouth a corresponding attachment in DB

We have a site with an upload directory that it's in a mess. There are thousands of files that exist on disk, but that don't have a corresponding DB attachment. At the same time, there are many ...
0
votes
1answer
23 views

Search by Attachment ID

I'm building a stock photo page for my company where we upload all photos our staff created so that it can be used later. It shows the ID of the image by post->ID so that users can see it, note it and ...
5
votes
1answer
103 views

Add custom class to attachment in media library grid mode

In the above screenshot we are in the media library with grid mode active. I want to add a custom class depending on the attachment filter wp_prepare_attachment_for_js. For example i hook to the ...
0
votes
2answers
38 views

Looking to limit file attachment downloads

I am using WP user front end plugin to let users submit posts to my site that includes a file on that post that other users can download. The problem is I want user-a to only be able to download a ...
0
votes
0answers
26 views

how to prefix image file name with 0001a, 0002b, 0003c and so on

Please look at the code below: var randomstring = (Math.random() + 1).toString(36).substring(7) + n; It creates a random characters + numbers combination to the image while renaming it. Original ...
0
votes
2answers
43 views

How to get Attachments(image) with specific width\height ratio

I need to get attachment images with horizontal orientation. I tried to use Meta_Query but I don't know how to compare two values (width and height) from one associative array that is in wp_postmeta ...
0
votes
1answer
82 views

Get post embedded image caption

I am trying to get the caption of post embedded images to then use on a lightbox. This is my code: function my_theme_prefix_content_gallery( $content ) { global $post; $args = array( ...
0
votes
1answer
17 views

Attachment file display link text

This is driving me slightly demented. It's taken me a few hours to work out how to do this and I thought I finally had it, but the link text will only echo the file name and not the link text I want ...
0
votes
0answers
68 views

add attachment-filters on custom modal-media insert

how can I do to have the attachment-filters menu in my upload window? my upload wordpress deafult upload console.log("enqueque on metabox.php - media3.js"); openMedia = { data: false, v: ...
0
votes
0answers
24 views

Add text to wp_get_attachment_image_src

I am calling the thumbnail image this way: <?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 300,300 ), false, '' ...
0
votes
2answers
40 views

How to change _wp_attachment_metadata specific value in SQL?

i had to resize a lot of existing images in my upload folder (around 1k). After reuploading them, Wordpress of course, doesn't recognize the new dimensions. My approach was to just change the size in ...
0
votes
0answers
36 views

Upload media via PHP

I'm trying to upload an image to the media-section, that is uploaded as dataurl to the server. I already have the image written into the database and uploaded to the most recent uploads subfolder. ...
0
votes
1answer
13 views

Limit attachment caption characters

I want to limit the characters a user is able to enter for the image/attachment caption. There are already long captions in the system and I don't wont to touch them. Any ideas on how to do this? I ...
0
votes
1answer
23 views

Troubles with code for upload a image

can someone give me please a code for image upload ? i try many but no one works , this is what i have : $post = array( 'comment_status' => $comment_status, ...
0
votes
0answers
62 views

Featured image does not work with images on a post at the frontend?

[Found a partial solution] I need a little help with this problem. I don't know why on my videos the theme uses a thumbnail and set it as featured image but for images it does not. When I install a ...
0
votes
0answers
22 views

Use audio file like image featured

Attempt to get the url of an audio file in post content to display in the loop of the home page. I can only get it if the file is uploaded at the time of creating the post, but if I go to a post ...
0
votes
0answers
31 views

Avoid Duplicate Attachment By Numbering Duplicate post title Wordpress

Hello friends i am running an wallpaper site with WordPress, There are i have more than 2 thousand images recently i get duplicate attachment title issue in webmaster. So i want to numbering duplicate ...
0
votes
0answers
14 views

wordpress gallery captions

I'm trying to develop a simple content site with wordpress which requires a slider gallery with unique captions for each image within the gallery. $gallery = get_post_gallery_images( $post ); Using ...
0
votes
2answers
62 views

wp_get_attachment_image not to get the post_thumbnaill

I have a setup, where I want to achieve that I have a big Picture of a product (Post-image), and then below a list of other thumbnails, which can be opened in a Lightbox. I made this, by querying the ...
0
votes
0answers
14 views

How to compare 2 attachment tags against category tag

I need to compare 2 tags from an image attachment against tags that are used in categoryID=2. And only get returned the tag that is used under the categoryID=2. With that, I should get returned just 1 ...
0
votes
2answers
32 views

Link FROM attachment to full post and get custom fields values on attachment page?

This shouldn't be so hard! But I cannot find the answer to this question on Google.. How can I link from an attachment template to the full post please? Bonus question! How can I grab the custom ...
-1
votes
1answer
51 views

How to force regenerate thumbnails in Wordpress posts?

We recently changed themes. The new theme uses different dimension thumbnails and I was a bonehead and deleted all previous thumbnail sizes. Deleting the thumbnail sizes results in many of the images ...
1
vote
0answers
38 views

Attachment page 404

After I uploaded some files into the Media Library, I clicked "View attachment page" in "Attachment Details", but I got a 404 not found error. The URL is like http://example.com/filename/ and there is ...
0
votes
1answer
57 views

WP media attachment location vs permalink

Yesterday I moved my sites from http://www.example.com to (secure site and removed the www). Now when I look at an attachment page I see the File URL as the old http://www ... but the page permalink ...
1
vote
0answers
40 views

wp_upload_bits Upload Specific Sizes Only

For images uploaded using this code, I want to only upload the full-size image and the thumbnail (whereas for images uploaded through site, I want all sizes). However, I can't figure out how to make ...
0
votes
0answers
12 views

Media settings image sizes ignored in attachment display settings when uploading image

I know this question has been asked before here; Settings in 'Media > Settings' is ignored when inserting images I tried all suggestions and none of them work for me. I've set the image ...
0
votes
0answers
12 views

Prevent non-admin to deattache media

We use Woothemes Sensei plugin as our Learning Management System. We also use Sensei Media Attachments plugin, in order to attach PDFs to our lessons CPT. Well, from time to time some PDFs are being ...
0
votes
1answer
11 views

Get posts associated with media attachment

Is there a good way to find all posts that contain a specific image? I'm working on the attachment single template, and I'd like to list the posts that contain that image.
5
votes
0answers
119 views

Uploaded images don't show in Media Library if there are special characters in IPTC Keywords

Some images that are uploaded to WordPress don't show up in the Media Library. The images get uploaded and even cropped to the defined sizes, there is an entry in the Media Library, but the preview ...