Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options answers only user 4771

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.

2
votes
In the Add Media window, click the "File URL" button, not "Post URL" before inserting it into the post.
answered Apr 20 '11 by Milo
4
votes
WordPress has a function, get_allowed_mime_types, which will return all allowed types. We can filter this list and exclude any types containing image, then query for all remaining types by passing the …
answered Feb 14 '13 by Milo
1
vote
get_post_meta returns an array when you set the 3rd parameter to false, so $value is an array in your metabox callback and you're treating it as string. I assume an attachment has a single value for l …
answered Oct 11 '15 by Milo
0
votes
See the media_handle_upload and media_sideload_image functions to upload images and attach them to a post. You can get the url of a specific size with the returned attachment ID and the wp_get_attachm …
answered Jan 8 '13 by Milo
2
votes
You're on the right path with a rewrite rule. If you're just delivering a file, you can hook an early action, check if a download was requested, then output the file and exit before WordPress ever get …
answered Jan 26 '15 by Milo
0
votes
Looking at the query it generates, it does appear to be a bug of sorts. 'status' => 'inherit' is interpreted as the parent's status, when the entry in the db for the attachment is literally 'inherit'. …
answered Apr 19 '11 by Milo
0
votes
When you insert an image it becomes an attachment, whether you link to that page or not. You can simply select 'none' in the link url field when the image is inserted, it's one of the options in the m …
answered Aug 3 '11 by Milo
6
votes
get_post_ancestors can give you the ID of the object an attachment is associated with: $attachment_id = 42; $parent = get_post_ancestors( $attachment_id ); echo $parent[0]; // $parent will be an arra …
answered May 17 '14 by Milo
0
votes
You can get the original attachment filename via wp_get_attachment_url: echo basename( wp_get_attachment_url( $post->ID ) ); or in the form of the example you provided: <a href="mailto:me@whatever …
answered Mar 20 '13 by Milo
0
votes
You could achieve that by adding a rewrite endpoint via add_rewrite_endpoint. This post from a WordPress developer has a good explanation of how they work.
answered Oct 2 '12 by Milo
1
vote
Attachments are posts of type attachment with the parent field set to the post ID they are attached to. The simplest way to see how this works is to look at the attachment functions in core code, /wp-includes/post.php. …
answered Jul 16 '13 by Milo
0
votes
Attachment is just post_parent value of the attachment post object, you can update that via wp_update_post: foreach( $gallery_array as $value ) { $the_post = array( 'ID' => $va …
answered Dec 1 '15 by Milo
0
votes
If you look at media_handle_upload in source you'll see how it uses wp_handle_upload to do just the uploading part of the process without inserting an attachment.
answered Apr 7 '13 by Milo
1
vote
Have a look at wp_localize_script for passing php data to javascript. A pseudo-code example: $tracks = array(); foreach( $mp3_attachments as $mp3_attachment ): $tracks[] = array( 'mp3' = …
answered Apr 5 '13 by Milo
0
votes
See Codex for the example in media_handle_sideload function.
answered Nov 22 '12 by Milo

15 30 50 per page