Questions tagged [attachments]
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.
999 questions
0votes
1answer
10views
Can you open a media frame to sellect an attachment to associate with another attachment you are editing on an existing media frame?
I want to have a media frame that pops up on click of a button on an existing media frame. This way I can associate another attachment with that attachment. This question shows an example of you can ...
0votes
0answers
65views
Block Theme : Query Loop with attachments
I am new to wordpress development. These day I am trying to create my own block theme in wordpress. In my theme, I have added two file upload fields to default wordpress posts using ACF pluign. It is ...
0votes
1answer
64views
Get Specific Files (Only Specific Extension Type All Files in Loop ) from Media
I want to get Specific Extension Files from Media of Current Post Uploads—for Instance, .jpg or .png or .pdf, or MP4. (Get Only 1 Extension All Files From Current Post Uploads) Specific Extension ...
0votes
1answer
103views
Define how an attached image is rendered
When inserting an image block to a post, I want to control how the image is actually insterted in HTML. Specifically, I want to replace the autogenerated img element with a picture one, in order to ...
1vote
0answers
34views
How to insert information about the size and type of an attachment into page
I have a page and attachment addes to this page. Now I can output the content of this page with modified link attachment, when each attachment link otput title size and type of attachment like this &...
1vote
1answer
35views
wp_get_attachment_links do not modify output for attachment links
I use filter for change link for attachments in a page function custom_attachment_link($markup, $id, $size, $permalink, $icon, $text) { // Get attachment meta data $attachment_meta = ...
0votes
1answer
75views
Display file size and type on page or post with attachments
I have page and post in which user upload files as attachment and display link for donwload this files. How I can display after the size link type of uploaded file and the size? After answer in this ...
0votes
0answers
141views
Using wp_mail to send attachment from a file stream content
I am using wp_mail to send mail with attachment. The attachment is not stored anywhere. The attachment contents are fetched viacurl request. This is what I wrote. This function below (...
0votes
1answer
40views
How to prevent wordpress from redirecting media attachment page to media page?
For some reason googlebot tried to index my media attachment pages and got redirected to media pages. This seems to be a default wordpress behavior. To recreate it, upload an image called test.jpg to ...
0votes
1answer
157views
Can I redirect media urls (not attachment pages) to the post parent?
I have a really unorthodox use case, perhaps. We have a set of pdf files which our colleagues would like to track downloads for. We have been using our web server logs to get code 200 requests for ...
1vote
1answer
129views
How can I get all attachments by a user on a WP multisite network?
I'm creating a front-end based project where users can make posts and add images to them. It's a network of sites that users have access to. For a better user experience, I want users to be able to ...
1vote
1answer
478views
wp_get_attachment_image with custom size not rendering possible 2x srcset image
I'm noticing a difference (bug?) in how WP is rendering srcset images now. If I register my image sizes with add_image_size('single_featured_image', 1280, 9999, false); add_image_size('...
0votes
1answer
170views
Get field added via attachment_fields_to_edit filter in Gutenberg
In a plugin I'm building, I've added a field named attribution to attachments via the attachment_fields_to_edit filter. I'm trying to get this info in the block editor but when I output the variable ...
0votes
1answer
119views
All uploaded files using wp_mail() renamed to tmp_name
I am attempting to retain the original file name of my uploaded file using wp_handle_upload() and wp_mail(). Currently, all files are retaining their original file extension, but renaming themselves &...
0votes
1answer
171views
How to append $metadata['sizes'] to metadata when using 'wp_generate_attachment_metadata?
When a file such as an image is uploaded, an optimized version is created with $saved = $editor->save($editor->generate_filename('name'));. This successfully writes the file to disk and the ...