Attachments (Media files) (category)

get_attached_file()

Retrieve attached file path based on attachment ID.

get_attached_media()

Retrieves media attached to the passed post.

get_attachment_link()

Retrieves the permalink for an attachment.

get_children()

Retrieve all children (attachments, revisions, or sub-pages) of the post parent ID. It works similar to get_posts().

get_post_mime_type()

Retrieve the mime type of an attachment based on the ID.

is_local_attachment()

Check if the attachment URI is local one and is really an attachment.

the_attachment_link()

Display an attachment page link using an image or icon.

wp_attachment_is()

Verifies an attachment is of a given type.

wp_delete_attachment()

Trash or delete an attachment.

wp_get_attachment_link()

Gets a link to the attachment file or WP attachment page. Returns the <a> tag.

wp_get_attachment_url()

Retrieve the URL for an attachment.

wp_get_original_image_path()

Retrieves the path to an uploaded image file.

wp_get_original_image_url()

Retrieve the URL to an original attachment image.

wp_insert_attachment()

Insert an attachment.

Thumbnails

add_image_size()

Registers a new image size (thumbnail).

delete_post_thumbnail()

Remove a post thumbnail.

get_intermediate_image_sizes()

Gets the available intermediate image sizes.

get_post_thumbnail_id()

Gets the ID of the current (or specified) post thumbnail (featured image). Gets ID of WP attachment (image).

get_the_post_thumbnail()

Gets the IMG tag of the post thumbnail (if exists).

get_the_post_thumbnail_caption()

Gets the post thumbnail caption (description).

get_the_post_thumbnail_url()

Gets the thumbnail URL specified for the post. If there is no post thumbnail, it returns false.

has_image_size()

Check if an image size exists.

has_post_thumbnail()

Check if post has an image attached.

image_get_intermediate_size()

Retrieves the image's intermediate size (resized) path, width, and height.

remove_image_size()

Removes a previously registered image size by it name. The new image size is registered with add_image_size().

set_post_thumbnail()

Set a post thumbnail.

set_post_thumbnail_size()

Registers an image size for the post thumbnail.

the_post_thumbnail()

Display the post thumbnail.

the_post_thumbnail_caption()

Displays the post thumbnail caption.

the_post_thumbnail_url()

Display the post thumbnail URL.

wp_get_additional_image_sizes()

Gets data of all additionally registered image sizes (thumbnails).

wp_get_attachment_thumb_url()

Retrieve URL for an attachment thumbnail.

wp_get_image_editor()

Returns a WP_Image_Editor instance and loads file into it.

wp_get_registered_image_subsizes()

Returns a normalized list of all currently registered image sub-sizes.

Rarely used

attachment_url_to_postid()

Tries to convert an attachment URL into a post ID.

get_allowed_mime_types()

Retrieve list of allowed mime types and file extensions.

wp_get_audio_extensions()

Returns a filtered list of WP-supported audio formats.

wp_get_ext_types()

Retrieves the list of common file extensions and their types.

wp_get_video_extensions()

Returns a filtered list of WP-supported video formats.

wp_read_image_metadata()

Get extended image metadata, exif or iptc as available.

Metadata (postmeta)

delete_post_meta_by_key()

Deletes everything from post meta matching the given meta key.

wp_generate_attachment_metadata()

Generate post thumbnail attachment meta data.

wp_get_attachment_metadata()

Retrieve attachment meta field for attachment ID.

wp_maybe_generate_attachment_metadata()

Maybe attempts to generate attachment metadata, if missing.

wp_read_audio_metadata()

Retrieve metadata from a audio file's ID3 tags

wp_update_attachment_metadata()

Update metadata for an attachment.

Images

file_is_displayable_image()

Validate that file is suitable for displaying within a web page.

image_downsize()

Scale an image to fit a particular size (such as 'thumb' or 'medium').

next_image_link()

Displays next image link that has the same post parent.

previous_image_link()

Displays previous image link that has the same post parent.

wp_attachment_is_image()

Determines whether the specified post is WordPress attachment image. A conditional tag.

wp_get_attachment_caption()

Retrieves the caption of specified attachment.

wp_get_attachment_image()

Get an HTML img element representing an image attachment

wp_get_attachment_image_sizes()

Retrieves the value for an image attachment's 'sizes' attribute.

wp_get_attachment_image_src()

Gets an array of data for the specified image: URL, width, height of the attachment image.

wp_get_attachment_image_srcset()

Retrieves the value for an image attachment's 'srcset' attribute.

wp_get_attachment_image_url()

Get the URL of an image attachment.

wp_get_image_mime()

Gets the real MIME type of an image file.

Gallery

get_post_galleries()

Retrieves galleries from the passed post's content.

get_post_galleries_images()

Retrieve the image srcs from galleries from a post's content, if present

get_post_gallery()

Check a specified post's content for gallery and, if present, return the first

get_post_gallery_images()

Retrieves an array of image URLs that belong to the first gallery of the specified post.

Upload/Download

media_handle_sideload()

Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload().

media_handle_upload()

Save a file submitted from a POST request and create an attachment post for it.

media_sideload_image()

Downloads an image from the specified URL and attaches it to a post.

wp_check_filetype()

Retrieve the file type from the file name.

wp_check_filetype_and_ext()

Attempts to determine the real file type of a file.

wp_get_upload_dir()

Retrieves uploads directory information.

wp_handle_sideload()

Wrapper for _wp_handle_upload().

wp_handle_upload()

Wrapper for _wp_handle_upload().

wp_max_upload_size()

Determines the maximum upload size allowed in php.ini.

wp_unique_filename()

Get a filename that is sanitized and unique for the given directory.

wp_upload_bits()

Create a file in the upload folder with given content.

wp_upload_dir()

Get an array containing the current upload directory's path and url.