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

When inserting attachments into a blog post, how can I get Wordpress to use the full filename with the extension?

I'm using WordPress as a way to keep track of several different types of data which all have different extension names -- file1.fig, file2.dat, etc. When I upload a file and insert it into a blog ...
2
votes
1answer
47 views

Can I disable this core query?

When a user creates/updates a post within the admin, it takes between 15 and 30 seconds for that operation to complete. The culprit appears to be this slow query: SELECT ID FROM wp_posts WHERE ...
0
votes
0answers
12 views

How could I add button next to “edit image” button in “Attachment Details”

How could I add button next to "edit image" button in "Attachment Details" This is the location I would like to add button, Do you have any recommend?
1
vote
1answer
24 views

Getting “too many redirects” when using wp_redirect for attachment page

Code comes from the codex: <?php wp_redirect( get_permalink( $post->post_parent )); exit; ?> I added the above, in an empty attachment.php page. When I visit an attachment page (eg. ...
0
votes
0answers
7 views

Delete duplicate media in SQL only

I have uninstalled WPML and deleted all WPML tables in the DB. Now, I have duplicate media (one per old languages) in my SQL only (not in the FTP). I would like to delete these duplicates and only ...
0
votes
1answer
25 views

how to get attached file url for current post?

Trying to get the attachment file url for current post, using this code: if ( is_singular('post') ) { $args = array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'post_status' => ...
1
vote
2answers
34 views

shortcode get thumbnail size

How to get shortcode thumbnail size? my code get shortcode thumbnail size in functions: function thumb_medium( $atts, $content = null ) { return wp_get_attachment_url( get_post_thumbnail_id( ...
0
votes
0answers
23 views

Attach Gravity Form File Upload to Custom Page and Set Image Title & Description from Form Fields [on hold]

I have a Gravity Form with fields for name, city and file upload. I would like the file uploaded to a) get attached to a specific page (not the page with the form) and b) have the image's title & ...
1
vote
0answers
14 views

How to change the attached image's name after save post? [closed]

I would like to let the user upload images with any name, and automatically modify their name to the format as %post_id%-01, %post_id%-02, %post_id%-03... when save post. And I'm using the plugin ...
0
votes
0answers
24 views

Get Previous & Next Attachment Links (With Thumbnails)

I'm building a theme that explicitly displays an attachment on a single page (not using attachment.php at this time, but the idea is the same). I have the 'attachment_id' value, and the attachment ...
0
votes
0answers
10 views

get_children() show deleted attachments of the post

I have a problem with the attachments in a post :( If I upload an image into a post and after I delete it, Wordpress show the image as still attached to that post. This is my code to retrive the ...
0
votes
0answers
4 views

Gallery attached to a post but outside it (my-post-url/my-gallery)

I want to create a post gallery related to a WordPress post, but outside it, for example: my-post-url -> Display my post. my-post-url/gallery -> Display my galelry.
2
votes
0answers
17 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, ...
2
votes
1answer
16 views

Add column for attachment file size

EDIT. I got this working, see my own answer below: Now, if someone has any clue as to how I can get this sortable, please chime in! :) ---------------- Original question ---------------- How can I ...
0
votes
0answers
40 views

Get video attachment ID and display length

I need to show length of a video attachment. Video is in media library. I put the video normally, by wp administration. I am using this code in content.php, inside the loop, after this: <?php ...
0
votes
0answers
11 views

Stop images from being displayed on the front-end of the site

I run a store with woocommerce on Wordpress, however there is an image called 'basket.png', and for some reason it has taken the link /basket on the site. Is there a way to disable all of the ...
0
votes
1answer
44 views

Prevent image from being accessible via url as a post?

I've noticed that if I upload an image to the media library it is given a post_name in the database and is then accessible via mysite.com/wordpress/its-post_name. It only seems to do it if I upload it ...
1
vote
0answers
31 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 ...
0
votes
0answers
17 views

Changing attachment status from inherit to pending?

I'm creating a web library that consists of about 1,000 PDF files uploaded as attachments (in addition to pages and posts which contain other information). I've bypassed the attach-to-a-page/post ...
0
votes
0answers
13 views

Checkbox group on attachments page

I am trying to add check boxes on media page depending upon no of roles in the system and I have been able to do that like this. function add_custom_attachment_fields($form_fields, $post){ ...
4
votes
2answers
199 views

What is the different between an attachment in wp_posts and an attachment in wp_postmeta?

After the Woocommerce dummy products are imported, I notice that in the database, there are different records in different tables but point to THE SAME photo attachment. The question is why? What are ...
0
votes
1answer
38 views

missing attachment are showing as 404

In Google WebMaster Tools the crawling errors page is showing 177 missing urls. Most of them are showing as ?attachment_id=xxx I have looked in the database for these id's in the wp_posts table but ...
0
votes
0answers
16 views

Update wp.media state (mainly order) of images in Add Media Modal

I have to mimic a feature that was part of Wordpress 3.5 but was removed in Wordpress 4.0. When I am seeing the files uploaded to a post in the Add Media Modal, if I chose "Uploaded to this post", I ...
0
votes
1answer
101 views

How to get image title/alt attribute?

in my wite theme, there is no alt tag configured in home slider post, i have added alt text with image from media upload. i have added below code to add / retrieve alt tag. but it display blank ...
0
votes
1answer
161 views

Upload multiple image with media_handle_upload with multiple file field [duplicate]

I need to add multiple images with image descriptions form wp admin. Admin Form: <label for="image[]">Image</label> <input type="file" name="image[]"/> <label ...
0
votes
0answers
9 views

Get the dimensions of an embedded image

I am trying to position content based on the size of the first embedded image in a post. I am retrieving the image URL using a custom function, and then using another function to retrieve the ID of ...
0
votes
2answers
53 views

All attachment pages give 404

I have a major issue with wordpress on my new website. Anytime I upload a new media, its attachment page gives me a 404. My permalink structure is the following: baseurl + ...
1
vote
1answer
52 views

Massive photogallery import

I have this scenario: about 200 photo galleries to recreate in Wordpress from an old wordpress site. All I have is the .xml WXR for the post_type "photogallery" that basically creates the gallery and ...
0
votes
0answers
40 views

Post Type with Feature Image + Image from metabox - Catch each a unique way

I have a Custom Post Type and'm using an image metabox (Odin theme metabox class). I need to render loop in the url image bgimg metabox, and Featured image as .... The Contrary I can, however when ...
0
votes
0answers
94 views

get_attached_media() returns empty array if media file already used by another post

I wish to retrieve the different PDF and ZIP files attached to a single post and display them in a specific section, outside the content, using the WP function get_attached_media(). While my code ...
0
votes
0answers
11 views

Generate attachement to Post from featured image

I am using WP-JSON API Plugin. If i choose an image as featured that is allready uploaded in my media library it does not generate attachements Object in JSON like the example bellow. ...
0
votes
3answers
34 views

wp_query get attachments in larger size

I'm using wp_query to get all attachments, and it works, but I wonder how could I get attachments in full size because this query returns images in medium. <?php $args = array('post_status' ...
0
votes
0answers
25 views

Post comments getting added to unrelated media, not post

I'm in the process of setting up and testing a new WP install (this is my first time setting up my own WP site). With a test user I added a comment to a post. After refreshing the post page a few ...
1
vote
1answer
73 views

delete image attachments of a custom post type except featured image

I have a custom-post-type called "newcomer". I am trying to put together a function which would delete all image attachments (except featured image) of a custom-post-type when the CPT post is updated ...
1
vote
0answers
44 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 ...
0
votes
0answers
112 views

Delete attachment script

I have script, but only half works. It deletes "alternate" post but not delete the attachment. The script: function cs_delete_directory_post(admin_url, post_id){ if(confirm('Delete Post')){ ...
0
votes
0answers
17 views

Get post attached in sequence

I'm trying to do a reader, that will take images that are attached to the post.Kinda like a comic book reader, which has a button to the next image. However only saw snippets that show to catch the ...
0
votes
0answers
23 views

After I upload a file to library its name converted to dashes

I've a problem when I upload Attachment file (any extension) with Arabic name, for example اسم الصورة.jpg, It renamed to -------------.jpg ! I've plugins to crop the uploaded Image, I tried to ...
0
votes
2answers
36 views

Getting a taxonomy's thumbnail url

This is how I am currently trying: $taxonomies = array( 'product_cat' ); $args = array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => ...
0
votes
1answer
67 views

Get the title and URL of the attachment parent post

Goal: From my image.php, I am displaying the attachment image and some descriptions. I also want get the post from where it was originally posted. I only need the title and the url so that you can ...
0
votes
2answers
27 views

get_post orderby not working in plugin

Please take a look at the loops below, I'm having issues trying to order the attachment by title, name, and modified. <?php foreach ($instance['data'] as $id) : ...
3
votes
1answer
85 views

How can I display image metadata?

I'm trying to add a filter to the_content that will find all images in the post and append the custom attachment metadata credit to it. Here's the functions I've have: Adds the Credit field to ...
0
votes
0answers
27 views

Attach image from a folder while inserting post from CSV file (1 post)

I have a CVS file with almost 5000 records and I want to insert records into custom post with custom fields. I have one column (attachment) image type and I want to insert and attach image into the ...
0
votes
1answer
68 views

Change permalink to attachment

Hello i found this code and I modified a litle, but i have a problem with it. I want the link of the attachment page to be something like this [post-permalink]/[gallery]/[postid] 1234/ .. /1253/ ...
0
votes
2answers
105 views

Creating attachments archive in tags and categories

Per this question (How to create an attachments archive with working pagination?), I've been using the following function to have archive pages display attachments as well as pages and posts. It was ...
0
votes
0answers
31 views

Change the number of attachments loaded into the Media Popup window

I wish to ask if is there a way to change the numbers of thumbnails loaded in the media popup when it first opens. The Media Popup loads thumbnails through ajax (query-attachments), executing up to ...
6
votes
0answers
225 views

Get upload URL by blog ID in multisite

The essence of the question is, I'm looking for a solution like this: $blog_upload_dir_info = wp_upload_dir( $date, $blog_ID ); $blog_upload_url = $blog_upload_dir_info[ 'baseurl' ]; Where ...
0
votes
0answers
29 views

Include gallery in attachment permalink

I need a fix for my gallery attachments on WordPress. Now when adding a gallery the permalinks are something like that : mydomain/the_post_name/image_file_name/ But I want to do something like ...
0
votes
1answer
104 views

JSON API Plugin not showing Attachments id reused

First of all, I am talking about this plugin: https://wordpress.org/plugins/json-api/ So now regarding my problem: The plugin is working fine and without any problems. All attachments are showen for ...
1
vote
1answer
43 views

Do attachments added to custom post types have a post parent?

On attachment pages, I have a link back to the post/page where the file was uploaded. (This is not displayed for files that were directly added to the Media Library and that's fine.) For attachments ...