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

Upload multiple image with media_handle_upload with multiple file field

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
7 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
20 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 + ...
0
votes
0answers
12 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 ...
-1
votes
0answers
14 views

How to add download manager files in google xml sitemap? [closed]

I'm using Download Manager Plugin. https://wordpress.org/plugins/download-manager/ So with every post in attachment i have pdf file. So it should be crawled in google. So for XML Sitemap i'm using ...
0
votes
0answers
14 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
31 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
7 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
23 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
15 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
52 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
25 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
89 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
16 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
21 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
23 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
40 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
25 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
51 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
20 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
34 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
34 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
19 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 ...
4
votes
0answers
112 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
22 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
59 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
0answers
33 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
14 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
26 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
54 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
73 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
63 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
19 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
80 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
44 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
80 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
12 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 ...
0
votes
2answers
71 views

How to get images only attached from edit post page

I have developed a custom wordpress panel with a custom front-end recently. In single post pages there is a slider. I display the result of get_attached_media( 'image' ) function as the images of ...
2
votes
1answer
70 views

wp_get_attachment_image_src and server path

wp_get_attachment_image_src will give me URL and dimensions for an image. But is there any way to get the server path for a scaled image (like ...
1
vote
1answer
66 views

How do I change attachment slug from name to id

I need to change the slug of the attachment post. Currently, it is showing attachment name , I want it to be replaced by id of attachment. Edit : Thanks to suggestion by TheDeadMedic, I am now ...
0
votes
0answers
21 views

Prevent user to see detail view of attachment of another user

This plugin prevents unprivileged users to see images, that other users uploaded: add_filter('parse_query', 'own_content_only_restriction' ); function own_content_only_restriction( $wp_query ) { ...
0
votes
0answers
44 views

How to change html generated by wordpress media uploader

I have managed to change the output of wordpress media uploader using image_send_to_editor exampled below (where the output is image:($url)) However I want to do the same with other files like ...
0
votes
1answer
48 views

Hide Image Container if No Image Attachments

I have a CPT that displays any attached images via a slider. However, when there are no attached images the slider still appears. Is there a way to add a conditional IF statement that will hide the ...
0
votes
1answer
34 views

Getting attachments by meta value

I'm stuck at a very simple point: I need to get all attachments by a custom meta key (and value). I'm developing a short code, so it has to work on every possible page. What I've tried so far: $args ...
0
votes
0answers
28 views

Duplicate Button on Attachment Details Modal

I tried to find a solution, but no success. I need to add duplicate button on the bottom of Attachment Details Modal Window ( where are "View attachment page | Edit more details | Delete Permanently" ...
0
votes
1answer
67 views

Adding meta data to an attachment post

I want to add a meta data to my attachment posts, so I can get them in order by meta value later. That meta value would be 'price'. So I thought this could work: I have this args: $args = array( ...
0
votes
1answer
142 views

Wordpress wp_get_attachment_thumb_url full

My code in index: (show all attachment by one post ID) <?php query_posts('p=1498'); if (have_posts()) { while (have_posts()) { the_post(); ?> <?php $args = array( 'post_type' => ...