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
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
8 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
13 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
31 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
27 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
21 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
13 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
10 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
164 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
27 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
13 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
57 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
55 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
8 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
36 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
48 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
27 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
62 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
9 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
28 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
19 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
61 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
39 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
98 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
22 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
29 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
52 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
26 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
64 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
23 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
52 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
39 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
22 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 ...
5
votes
0answers
150 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
26 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
82 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
40 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 ...
0
votes
0answers
19 views

Paginate Multisite Attachment WP_Query

I am working on a multisite blog network where I need to display x post per page and navigation at the of the bottom list. My code will not display a pagination at the bottom and displays x post per ...
0
votes
0answers
30 views

How to hide media link to settings?

I want disable MEDIA LINK TO settings for authors. I tried following code, but authors are still able to change settings. add_action( 'print_media_templates', function(){ echo ...
0
votes
0answers
71 views

Removing default alt text autofill or overriding it

What I'm trying to do is check if the user has entered the alt text for an image, and if not, then add alt text containing the post title to the image. I found a function that does this here: ...
0
votes
1answer
89 views

Media library images “missing” after migrating them using SQL

I am migrating a lot of posts from an old site to a new site, and these posts have a lot of Advanced Custom Field "relationship" data attached to them. Because of this, I want to keep all of the ids ...
1
vote
1answer
74 views

Get Attachment ID from URL [duplicate]

I have the URL of an image which I know is an attachment. Now, I need to find out the attachment ID. This is what I've got (thanks to PippinsPlugins): // retrieves the attachment ID from the file ...
0
votes
0answers
20 views

Can I attach the data from one post to another?

I'm looking to create a "snippets" plugin of sorts that lets me create a library of snippets. I then want to be able to attach those snippets to a post but not within the post_content. I basically ...
0
votes
0answers
18 views

How to pick up featured image from set of pictures

I'm trying to create front end form for posting. The following questions are concerning me so bad. How can I set a featured image? I tried set_post_thumbnail($pid, $newuploadid); but nothing happend. ...
0
votes
1answer
92 views

Insert attachments from front end form

I built a front end form but suddenly cannot submit my image attachments. Refer to these articles which do not get it done: ...
0
votes
0answers
49 views

Strange problem with wp_get_attachment_image_src database (db) query count

I have a purchased theme that has a custom WordPress loop in it that looks for image attachments via wp_get_attachment_image_src. It does this by doing the following: $image = ...
0
votes
1answer
98 views

How can I bulk delete media and attachments using WP-CLI?

I'm trying to mass delete 4000 images in a wordpress website. WP itself sets the max to 999, which would work fine and take a few minutes to delete them via the backend. However, I get REQUEST URI TOO ...
0
votes
0answers
13 views

Why WordPress attachments LINK TO settings are not working?

Using this code below, I added some on-hover share icons for all images of the content. But, now these images are not getting any "Link To" setting from authors. I don't know what is the problem. Can ...