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

8
votes
0answers
184 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 ...
3
votes
0answers
49 views

Custom collection in media manager?

I'm working on a plugin that extends the media manager, load JSON based input data to render an own collection of images and may upload them to my wordpress media library. So far I got my own tab, ...
3
votes
0answers
153 views

How to trigger a refresh in the media modal

I'm developing a plugin that adds a new tab to the media modal, and I need to know a way trigger a refresh of the attachments tab so it shows newly added attachments. This is the code I'm using: wp....
3
votes
0answers
189 views

Pulling Post Image Attachments in WordPress 3.9

For some reason the functions I'm using for pulling post images/attachments isn't working after updating to 3.9, has something changed in the way we pull attachments? The code I'm using in single.php ...
3
votes
0answers
102 views

How can I append custom data to images in the editor?

I've added a custom meta field to my image details so that a client can add a number to their photos (a design choice). The data would need to show up under each image (like a caption) inserted into ...
2
votes
0answers
93 views

Page Attachment Permalink Structure based on Menu Order?

I've been on a quest for the past couple of days reading up on Rewrite in WordPress but still can't seem to figure out how to accomplish this. When using pretty links in WordPress, media attached to ...
1
vote
0answers
45 views

Searching Custom Post Types

I am trying to create a search template to search attachments uploaded to a custom post type called folders. This is what I have so far: if ( $post->post_type == 'attachment' && $post-...
1
vote
0answers
17 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 "http://...
1
vote
0answers
32 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
0answers
31 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 ...
1
vote
0answers
47 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 ...
1
vote
0answers
45 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 ...
1
vote
0answers
20 views

Query to only return the 2 newest post attachments (images)?

How can you make a query that runs through all posts in a category and outputs only the 2 newest image attachments (most posts in the category have no attachments)? My current query is like this: $...
1
vote
0answers
132 views

Attachment page gives 404 if user not logged

I am struggling on a very weird behaviour for a WP site I have developed. My client have uploaded many photos to the media library, and tags them with some custom taxonomies I have defined. Some of ...
1
vote
0answers
81 views

Open the attachment details modal

The newer versions of WordPress, and possibly older ones, open an attachment details modal window when an image is selected in the media library. Is there a way that I can open this modal on a ...
1
vote
0answers
34 views

How to import files to individual posts of a custom type

I'm very inexperienced in WP, so I may have some fundamental misunderstandings - definitely open to alternative approaches if this one is crazy! I have a collection of several hundred files, split ...
1
vote
0answers
76 views

Automatically attach image to post if they have the same title

I have 200 images in my WP install. Currently, each image... has its own post (the post title is the same as the image title) is the featured image of that post is inserted into the post However,...
1
vote
0answers
210 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
0answers
106 views

Replacing the content of an image attachment using API

I have an existing image attachment, with a given ID. Is there a way, using API (specifically, Python Wordpress XML-RPC), to upload another image instead of the existing one, without creating a new ...
1
vote
0answers
989 views

Clean up images, delete unused image sizes attached to a post type

I found this post: How do I delete all generated images from my server except those currently used in posts which describes how to delete all image sizes but the original uploaded image file. I need ...
1
vote
0answers
88 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
0answers
287 views

Reorder “menu order” of attachments to another predefined order

I want to show photos attached to a post in a gallery using the built-in system with a custom order. Currently with the [gallery] shortcode it is posible to order it by name, by upload date, by ID, ...
1
vote
0answers
33 views

Add an attribute to attachments

Currently attachments have title caption alt text description I would like to add another attribute to that list (e.g source). How can I do this ?
1
vote
0answers
345 views

Custom image sizes add to metadata

I want to put resized files in original file metadata. //Original file $aid = wp_insert_attachment($attachment, $file['file'], $post_id); $a = wp_generate_attachment_metadata($aid, $file['file']); //...
1
vote
0answers
72 views

What is the best way to store thumbnails for a non-image attachment?

I'm in the process of extending Document Gallery to support generating and displaying thumbnails for each document. I've got thumbnail generation under control, but I'm curious as to what best ...
1
vote
0answers
320 views

Rename attachment filenames to attachment ID on upload

I have been trying this code out (based on this Change attachment filename ), it does not work properly. For instance, featured image is not being displayed in admin panel single post, neither are ...
1
vote
0answers
28 views

Change default selection for “Embed or Link”?

I want the default ATTACHMENT DISPLAY SETTINGS for media files (not images) to be set to "Link to Media File". I have found update_option snippets for images, but not audio/video. Can't find the media ...
1
vote
0answers
37 views

Rewrite all article pictures to link to file

I got a wordpress blog with thousands of articles. The problem: I want to use a lightbox plugin(http://wordpress.org/plugins/fancybox-for-wordpress/) but in order to work the pictures in an article ...
1
vote
0answers
158 views

Show message in media-new.php

I'm wondering if there's a way to show a specific message when user uploads a file using the wp-admin/media-new.php script. So far I have this: function my_uploads_notice(){ global $pagenow; ...
1
vote
0answers
334 views

How to create resized versions of images added with wp_insert_attachment

I'm uploading images to my media gallery and setting them as my post's featured image, which is working quite well. I'd like to generate thumbnails of these featured images, in the same way that ...
1
vote
0answers
168 views

How to edit attachment with media-upload.php?

I'm looking to edit an attachment and I'm trying to supply a link to the existing preview image. <a href="media-upload.php?type=image&TB_iframe=true&" class="thickbox" title="Edit Image" ...
1
vote
0answers
256 views

Upload iPhone video clips to blog via native WP app

I'm using the WordPress iPhone app, and when I upload video clips to a blog they show up in some browsers and in others not. I'm using a HTML5 video markup as a container for the clips. While mpeg-4 ...
1
vote
0answers
93 views

Regex to turn embedded images in to attachments

I've got a blog that has all images embedded in each post rather than a thumbnail linking to an attachment page which is what I'd like. I understand from this question that no plugin (like Regenerate ...
1
vote
0answers
99 views

WP_Query Attachment adds additional attachment count and need to link attachment to post url

I just wonder why WP_Query adding one more additional attachment with the defined number or posts. Also need to link attachment (thumbnail) to the post url. Here is my code <?php $query = new ...
1
vote
0answers
427 views

Query_posts and attachments

I need some guidance on some WP code. I'm wondering if it's possible to take this code (which is grabbing all the images from the posts across my site and dumping them out): $args = array( 'post_type'...
0
votes
0answers
2 views

Attachment Page Permalink/URL Rewrite Issue. How to change the actual rewriting?

I have a problem understanding the behavior of the Attachment Page Permalinks Into Setting-->Permalinks I have set http://www.example.com/sample-post/ as the preferred setting. When I upload an ...
0
votes
0answers
12 views

Why do i get the media files that I had detached from the posts(but still present in the media library)?

wp_get_attachment_url() is the method used to fetch the attachments. Currently I am passing the attachment IDs fetched by $attachments = get_children( array('post_parent' => get_the_ID(), '...
0
votes
0answers
12 views

How can I add an “Attach image to this post/page” link on the Add Media lightbox?

How can I add an "Attach image to this post/page" link on the Add Media lightbox? My theme uses attached images to generate sliders. I want to be able to attach images from Media Library to the ...
0
votes
0answers
12 views

Replace Uploaded Document if exists already

How to rename uploaded document if already exists with same name by adding numeric suffix. I want to override existing files (pdf,doc,image) if already exist with same name. Please tell me ...
0
votes
0answers
12 views

Getting Custom Attachment Meta Data from Custom Media Manager

I have a custom shortcode button which opens the media manager and allows you to insert an image into the post: (function() { var file_frame; tinymce.create('tinymce.plugins.customButtons', { ...
0
votes
0answers
13 views

Make Wordpress wp_delete_attachment delete files from a pre-defined custom folder

We have created a custom post type which allows our client to upload files to a folder outside of the standard Wordpress uploads folder (wp-content/upload-assets). These files are to be handled ...
0
votes
0answers
25 views

Problem uploading multiple images to a custom field in a front-end form

I'm having trouble with a portion of a front-end form that allows users to create posts in my custom post type. I want to create an image uploader that will allow the user to upload multiple images. ...
0
votes
0answers
11 views

Query by attachment image size

Is it possible to use WP_Query to get attachment images by pixel size? For example all images with a width of 500px and height of 300px. Or images with a height bigger than 300px. As far as i can ...
0
votes
0answers
32 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 can'...
0
votes
0answers
34 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 "Capture-d'écran....
0
votes
0answers
18 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
20 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
0answers
11 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
0answers
29 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
0answers
108 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: ...