[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> media.php (summary)

WordPress API for media display.

File Size: 6067 lines (210 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 5 files
 wp-includes/class-avif-info.php
 wp-includes/class-wp-image-editor.php
 wp-includes/class-wp-image-editor-gd.php
 wp-includes/class-wp-image-editor-imagick.php
 wp-includes/media-template.php

Defines 85 functions

  wp_get_additional_image_sizes()
  image_constrain_size_for_editor()
  image_hwstring()
  image_downsize()
  add_image_size()
  has_image_size()
  remove_image_size()
  set_post_thumbnail_size()
  get_image_tag()
  wp_constrain_dimensions()
  image_resize_dimensions()
  image_make_intermediate_size()
  wp_image_matches_ratio()
  image_get_intermediate_size()
  get_intermediate_image_sizes()
  wp_get_registered_image_subsizes()
  wp_get_attachment_image_src()
  wp_get_attachment_image()
  wp_get_attachment_image_url()
  _wp_get_attachment_relative_path()
  _wp_get_image_size_from_meta()
  wp_get_attachment_image_srcset()
  wp_calculate_image_srcset()
  wp_get_attachment_image_sizes()
  wp_calculate_image_sizes()
  wp_image_file_matches_image_meta()
  wp_image_src_get_dimensions()
  wp_image_add_srcset_and_sizes()
  wp_lazy_loading_enabled()
  wp_filter_content_tags()
  wp_img_tag_add_loading_optimization_attrs()
  wp_img_tag_add_width_and_height_attr()
  wp_img_tag_add_srcset_and_sizes_attr()
  wp_iframe_tag_add_loading_attr()
  _wp_post_thumbnail_class_filter()
  _wp_post_thumbnail_class_filter_add()
  _wp_post_thumbnail_class_filter_remove()
  _wp_post_thumbnail_context_filter()
  _wp_post_thumbnail_context_filter_add()
  _wp_post_thumbnail_context_filter_remove()
  img_caption_shortcode()
  gallery_shortcode()
  wp_underscore_playlist_templates()
  wp_playlist_scripts()
  wp_get_video_extensions()
  wp_video_shortcode()
  get_previous_image_link()
  previous_image_link()
  get_next_image_link()
  next_image_link()
  get_adjacent_image_link()
  adjacent_image_link()
  get_attachment_taxonomies()
  get_taxonomies_for_attachments()
  is_gd_image()
  wp_imagecreatetruecolor()
  wp_expand_dimensions()
  wp_max_upload_size()
  wp_get_image_editor()
  wp_image_editor_supports()
  _wp_image_editor_choose()
  wp_plupload_default_settings()
  wp_prepare_attachment_for_js()
  wp_enqueue_media()
  get_attached_media()
  get_media_embedded_in_content()
  get_post_galleries()
  get_post_gallery()
  get_post_galleries_images()
  get_post_gallery_images()
  wp_maybe_generate_attachment_metadata()
  attachment_url_to_postid()
  wpview_media_sandbox_styles()
  wp_register_media_personal_data_exporter()
  wp_media_personal_data_exporter()
  _wp_add_additional_image_sizes()
  wp_show_heic_upload_error()
  wp_getimagesize()
  wp_get_avif_info()
  wp_get_webp_info()
  wp_get_loading_optimization_attributes()
  wp_omit_loading_attr_threshold()
  wp_increase_content_media_count()
  wp_maybe_add_fetchpriority_high_attr()
  wp_high_priority_element_flag()

Functions
Functions that are not part of a class:

wp_get_additional_image_sizes()   X-Ref
Retrieves additional image sizes.

return: array Additional images size data.

image_constrain_size_for_editor( $width, $height, $size = 'medium', $context = null )   X-Ref
Scales down the default size of an image.

This is so that the image is a better fit for the editor and theme.

The `$size` parameter accepts either an array or a string. The supported string
values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
128 width and 96 height in pixels. Also supported for the string value is
'medium', 'medium_large' and 'full'. The 'full' isn't actually supported, but any value other
than the supported will result in the content_width size or 500 if that is
not set.

Finally, there is a filter named {@see 'editor_max_image_size'}, that will be
called on the calculated array for width and height, respectively.

return: int[] {
param: int          $width   Width of the image in pixels.
param: int          $height  Height of the image in pixels.
param: string|int[] $size    Optional. Image size. Accepts any registered image size name, or an array
param: string       $context Optional. Could be 'display' (like in a theme) or 'edit'

image_hwstring( $width, $height )   X-Ref
Retrieves width and height attributes using given width and height values.

Both attributes are required in the sense that both parameters must have a
value, but are optional in that if you set them to false or null, then they
will not be added to the returned string.

You can set the value using a string, but it will only take numeric values.
If you wish to put 'px' after the numbers, then it will be stripped out of
the return.

return: string HTML attributes for width and, or height.
param: int|string $width  Image width in pixels.
param: int|string $height Image height in pixels.

image_downsize( $id, $size = 'medium' )   X-Ref
Scales an image to fit a particular size (such as 'thumb' or 'medium').

The URL might be the original image, or it might be a resized version. This
function won't create a new resized copy, it will just return an already
resized one if it exists.

A plugin may use the {@see 'image_downsize'} filter to hook into and offer image
resizing services for images. The hook must return an array with the same
elements that are normally returned from the function.

return: array|false {
param: int          $id   Attachment ID for image.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array

add_image_size( $name, $width = 0, $height = 0, $crop = false )   X-Ref
Registers a new image size.

param: string     $name   Image size identifier.
param: int        $width  Optional. Image width in pixels. Default 0.
param: int        $height Optional. Image height in pixels. Default 0.
param: bool|array $crop   {

has_image_size( $name )   X-Ref
Checks if an image size exists.

return: bool True if the image size exists, false if not.
param: string $name The image size to check.

remove_image_size( $name )   X-Ref
Removes a new image size.

return: bool True if the image size was successfully removed, false on failure.
param: string $name The image size to remove.

set_post_thumbnail_size( $width = 0, $height = 0, $crop = false )   X-Ref
Registers an image size for the post thumbnail.

param: int        $width  Image width in pixels.
param: int        $height Image height in pixels.
param: bool|array $crop   {

get_image_tag( $id, $alt, $title, $align, $size = 'medium' )   X-Ref
Gets an img tag for an image attachment, scaling it down if requested.

The {@see 'get_image_tag_class'} filter allows for changing the class name for the
image without having to use regular expressions on the HTML content. The
parameters are: what WordPress will use for the class, the Attachment ID,
image align value, and the size the image should be.

The second filter, {@see 'get_image_tag'}, has the HTML content, which can then be
further manipulated by a plugin to change all attribute values and even HTML
content.

return: string HTML IMG element for given image attachment.
param: int          $id    Attachment ID.
param: string       $alt   Image description for the alt attribute.
param: string       $title Image description for the title attribute.
param: string       $align Part of the class name for aligning the image.
param: string|int[] $size  Optional. Image size. Accepts any registered image size name, or an array of

wp_constrain_dimensions( $current_width, $current_height, $max_width = 0, $max_height = 0 )   X-Ref
Calculates the new dimensions for a down-sampled image.

If either width or height are empty, no constraint is applied on
that dimension.

return: int[] {
param: int $current_width  Current width of the image.
param: int $current_height Current height of the image.
param: int $max_width      Optional. Max width in pixels to constrain to. Default 0.
param: int $max_height     Optional. Max height in pixels to constrain to. Default 0.

image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false )   X-Ref
Retrieves calculated resize dimensions for use in WP_Image_Editor.

Calculates dimensions and coordinates for a resized image that fits
within a specified width and height.

return: array|false Returned array matches parameters for `imagecopyresampled()`. False on failure.
param: int        $orig_w Original width in pixels.
param: int        $orig_h Original height in pixels.
param: int        $dest_w New width in pixels.
param: int        $dest_h New height in pixels.
param: bool|array $crop   {

image_make_intermediate_size( $file, $width, $height, $crop = false )   X-Ref
Resizes an image to make a thumbnail or intermediate size.

The returned array has the file size, the image width, and image height. The
{@see 'image_make_intermediate_size'} filter can be used to hook in and change the
values of the returned array. The only parameter is the resized file path.

return: array|false Metadata array on success. False if no image was created.
param: string     $file   File path.
param: int        $width  Image width.
param: int        $height Image height.
param: bool|array $crop   {

wp_image_matches_ratio( $source_width, $source_height, $target_width, $target_height )   X-Ref
Helper function to test if aspect ratios for two images match.

return: bool True if aspect ratios match within 1px. False if not.
param: int $source_width  Width of the first image in pixels.
param: int $source_height Height of the first image in pixels.
param: int $target_width  Width of the second image in pixels.
param: int $target_height Height of the second image in pixels.

image_get_intermediate_size( $post_id, $size = 'thumbnail' )   X-Ref
Retrieves the image's intermediate size (resized) path, width, and height.

The $size parameter can be an array with the width and height respectively.
If the size matches the 'sizes' metadata array for width and height, then it
will be used. If there is no direct match, then the nearest image size larger
than the specified size will be used. If nothing is found, then the function
will break out and return false.

The metadata 'sizes' is used for compatible sizes that can be used for the
parameter $size value.

The url path will be given, when the $size parameter is a string.

If you are passing an array for the $size, you should consider using
add_image_size() so that a cropped version is generated. It's much more
efficient than having to find the closest-sized image and then having the
browser scale down the image.

return: array|false {
param: int          $post_id Attachment ID.
param: string|int[] $size    Optional. Image size. Accepts any registered image size name, or an array

get_intermediate_image_sizes()   X-Ref
Gets the available intermediate image size names.

return: string[] An array of image size names.

wp_get_registered_image_subsizes()   X-Ref
Returns a normalized list of all currently registered image sub-sizes.

return: array[] Associative array of arrays of image sub-size information,

wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false )   X-Ref
Retrieves an image to represent an attachment.

return: array|false {
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
param: bool         $icon          Optional. Whether the image should fall back to a mime type icon. Default false.

wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = false, $attr = '' )   X-Ref
Gets an HTML img element representing an image attachment.

While `$size` will accept an array, it is better to register a size with
add_image_size() so that a cropped version is generated. It's much more
efficient than having to find the closest-sized image and then having the
browser scale down the image.

return: string HTML img element or empty string on failure.
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array
param: bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
param: string|array $attr {

wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false )   X-Ref
Gets the URL of an image attachment.

return: string|false Attachment URL or false if no image is available. If `$size` does not match
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
param: bool         $icon          Optional. Whether the image should be treated as an icon. Default false.

_wp_get_attachment_relative_path( $file )   X-Ref
Gets the attachment path relative to the upload directory.

return: string Attachment path relative to the upload directory.
param: string $file Attachment file name.

_wp_get_image_size_from_meta( $size_name, $image_meta )   X-Ref
Gets the image size as array from its meta data.

Used for responsive images.

return: array|false {
param: string $size_name  Image size. Accepts any registered image size name.
param: array  $image_meta The image meta data.

wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $image_meta = null )   X-Ref
Retrieves the value for an image attachment's 'srcset' attribute.

return: string|false A 'srcset' value string or false.
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
param: array|null   $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.

wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id = 0 )   X-Ref
A helper function to calculate the image sources to include in a 'srcset' attribute.

return: string|false The 'srcset' attribute value. False on error or when only one source exists.
param: int[]  $size_array    {
param: string $image_src     The 'src' of the image.
param: array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
param: int    $attachment_id Optional. The image attachment ID. Default 0.

wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $image_meta = null )   X-Ref
Retrieves the value for an image attachment's 'sizes' attribute.

return: string|false A valid source size value for use in a 'sizes' attribute or false.
param: int          $attachment_id Image attachment ID.
param: string|int[] $size          Optional. Image size. Accepts any registered image size name, or an array of
param: array|null   $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.

wp_calculate_image_sizes( $size, $image_src = null, $image_meta = null, $attachment_id = 0 )   X-Ref
Creates a 'sizes' attribute value for an image.

return: string|false A valid source size value for use in a 'sizes' attribute or false.
param: string|int[] $size          Image size. Accepts any registered image size name, or an array of
param: string|null  $image_src     Optional. The URL to the image file. Default null.
param: array|null   $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
param: int          $attachment_id Optional. Image attachment ID. Either `$image_meta` or `$attachment_id`

wp_image_file_matches_image_meta( $image_location, $image_meta, $attachment_id = 0 )   X-Ref
Determines if the image meta data is for the image source file.

The image meta data is retrieved by attachment post ID. In some cases the post IDs may change.
For example when the website is exported and imported at another website. Then the
attachment post IDs that are in post_content for the exported website may not match
the same attachments at the new website.

return: bool Whether the image meta is for this image file.
param: string $image_location The full path or URI to the image file.
param: array  $image_meta     The attachment meta data as returned by 'wp_get_attachment_metadata()'.
param: int    $attachment_id  Optional. The image attachment ID. Default 0.

wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id = 0 )   X-Ref
Determines an image's width and height dimensions based on the source file.

return: array|false Array with first element being the width and second element being the height,
param: string $image_src     The image source file.
param: array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
param: int    $attachment_id Optional. The image attachment ID. Default 0.

wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id )   X-Ref
Adds 'srcset' and 'sizes' attributes to an existing 'img' element.

return: string Converted 'img' element with 'srcset' and 'sizes' attributes added.
param: string $image         An HTML 'img' element to be filtered.
param: array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
param: int    $attachment_id Image attachment ID.

wp_lazy_loading_enabled( $tag_name, $context )   X-Ref
Determines whether to add the `loading` attribute to the specified tag in the specified context.

return: bool Whether to add the attribute.
param: string $tag_name The tag name.
param: string $context  Additional context, like the current filter name

wp_filter_content_tags( $content, $context = null )   X-Ref
Filters specific tags in post content and modifies their markup.

Modifies HTML tags in post content to include new browser and HTML technologies
that may not have existed at the time of post creation. These modifications currently
include adding `srcset`, `sizes`, and `loading` attributes to `img` HTML tags, as well
as adding `loading` attributes to `iframe` HTML tags.
Future similar optimizations should be added/expected here.

return: string Converted content with images modified.
param: string $content The HTML content to be filtered.
param: string $context Optional. Additional context to pass to the filters.

wp_img_tag_add_loading_optimization_attrs( $image, $context )   X-Ref
Adds optimization attributes to an `img` HTML tag.

return: string Converted `img` tag with optimization attributes added.
param: string $image   The HTML `img` tag where the attribute should be added.
param: string $context Additional context to pass to the filters.

wp_img_tag_add_width_and_height_attr( $image, $context, $attachment_id )   X-Ref
Adds `width` and `height` attributes to an `img` HTML tag.

return: string Converted 'img' element with 'width' and 'height' attributes added.
param: string $image         The HTML `img` tag where the attribute should be added.
param: string $context       Additional context to pass to the filters.
param: int    $attachment_id Image attachment ID.

wp_img_tag_add_srcset_and_sizes_attr( $image, $context, $attachment_id )   X-Ref
Adds `srcset` and `sizes` attributes to an existing `img` HTML tag.

return: string Converted 'img' element with 'loading' attribute added.
param: string $image         The HTML `img` tag where the attribute should be added.
param: string $context       Additional context to pass to the filters.
param: int    $attachment_id Image attachment ID.

wp_iframe_tag_add_loading_attr( $iframe, $context )   X-Ref
Adds `loading` attribute to an `iframe` HTML tag.

return: string Converted `iframe` tag with `loading` attribute added.
param: string $iframe  The HTML `iframe` tag where the attribute should be added.
param: string $context Additional context to pass to the filters.

_wp_post_thumbnail_class_filter( $attr )   X-Ref
Adds a 'wp-post-image' class to post thumbnails. Internal use only.

Uses the {@see 'begin_fetch_post_thumbnail_html'} and {@see 'end_fetch_post_thumbnail_html'}
action hooks to dynamically add/remove itself so as to only filter post thumbnails.

return: string[] Modified array of attributes including the new 'wp-post-image' class.
param: string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name.

_wp_post_thumbnail_class_filter_add( $attr )   X-Ref
Adds '_wp_post_thumbnail_class_filter' callback to the 'wp_get_attachment_image_attributes'
filter hook. Internal use only.

param: string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name.

_wp_post_thumbnail_class_filter_remove( $attr )   X-Ref
Removes the '_wp_post_thumbnail_class_filter' callback from the 'wp_get_attachment_image_attributes'
filter hook. Internal use only.

param: string[] $attr Array of thumbnail attributes including src, class, alt, title, keyed by attribute name.

_wp_post_thumbnail_context_filter( $context )   X-Ref
Overrides the context used in {@see wp_get_attachment_image()}. Internal use only.

Uses the {@see 'begin_fetch_post_thumbnail_html'} and {@see 'end_fetch_post_thumbnail_html'}
action hooks to dynamically add/remove itself so as to only filter post thumbnails.

return: string Modified context set to 'the_post_thumbnail'.
param: string $context The context for rendering an attachment image.

_wp_post_thumbnail_context_filter_add()   X-Ref
Adds the '_wp_post_thumbnail_context_filter' callback to the 'wp_get_attachment_image_context'
filter hook. Internal use only.


_wp_post_thumbnail_context_filter_remove()   X-Ref
Removes the '_wp_post_thumbnail_context_filter' callback from the 'wp_get_attachment_image_context'
filter hook. Internal use only.


img_caption_shortcode( $attr, $content = '' )   X-Ref
Builds the Caption shortcode output.

Allows a plugin to replace the content that would otherwise be returned. The
filter is {@see 'img_caption_shortcode'} and passes an empty string, the attr
parameter and the content parameter values.

The supported attributes for the shortcode are 'id', 'caption_id', 'align',
'width', 'caption', and 'class'.

return: string HTML content to display the caption.
param: array  $attr {
param: string $content Optional. Shortcode content. Default empty string.

gallery_shortcode( $attr )   X-Ref
Builds the Gallery shortcode output.

This implements the functionality of the Gallery Shortcode for displaying
WordPress images on a post.

return: string HTML content to display gallery.
param: array $attr {

wp_underscore_playlist_templates()   X-Ref
Outputs the templates used by playlists.


wp_playlist_scripts( $type )   X-Ref
Outputs and enqueues default scripts and styles for playlists.

param: string $type Type of playlist. Accepts 'audio' or 'video'.

wp_get_video_extensions()   X-Ref
Returns a filtered list of supported video formats.

return: string[] List of supported video formats.

wp_video_shortcode( $attr, $content = '' )   X-Ref
Builds the Video shortcode output.

This implements the functionality of the Video Shortcode for displaying
WordPress mp4s in a post.

return: string|void HTML content to display video.
param: array  $attr {
param: string $content Shortcode content.

get_previous_image_link( $size = 'thumbnail', $text = false )   X-Ref
Gets the previous image link that has the same post parent.

return: string Markup for previous image link.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: string|false $text Optional. Link text. Default false.

previous_image_link( $size = 'thumbnail', $text = false )   X-Ref
Displays previous image link that has the same post parent.

param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: string|false $text Optional. Link text. Default false.

get_next_image_link( $size = 'thumbnail', $text = false )   X-Ref
Gets the next image link that has the same post parent.

return: string Markup for next image link.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: string|false $text Optional. Link text. Default false.

next_image_link( $size = 'thumbnail', $text = false )   X-Ref
Displays next image link that has the same post parent.

param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: string|false $text Optional. Link text. Default false.

get_adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false )   X-Ref
Gets the next or previous image link that has the same post parent.

Retrieves the current attachment object from the $post global.

return: string Markup for image link.
param: bool         $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: bool         $text Optional. Link text. Default false.

adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false )   X-Ref
Displays next or previous image link that has the same post parent.

Retrieves the current attachment object from the $post global.

param: bool         $prev Optional. Whether to display the next (false) or previous (true) link. Default true.
param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
param: bool         $text Optional. Link text. Default false.

get_attachment_taxonomies( $attachment, $output = 'names' )   X-Ref
Retrieves taxonomies attached to given the attachment.

return: string[]|WP_Taxonomy[] List of taxonomies or taxonomy names. Empty array on failure.
param: int|array|object $attachment Attachment ID, data array, or data object.
param: string           $output     Output type. 'names' to return an array of taxonomy names,

get_taxonomies_for_attachments( $output = 'names' )   X-Ref
Retrieves all of the taxonomies that are registered for attachments.

Handles mime-type-specific taxonomies such as attachment:image and attachment:video.

return: string[]|WP_Taxonomy[] Array of names or objects of registered taxonomies for attachments.
param: string $output Optional. The type of taxonomy output to return. Accepts 'names' or 'objects'.

is_gd_image( $image )   X-Ref
Determines whether the value is an acceptable type for GD image functions.

In PHP 8.0, the GD extension uses GdImage objects for its data structures.
This function checks if the passed value is either a GdImage object instance
or a resource of type `gd`. Any other type will return false.

return: bool True if `$image` is either a GD image resource or a GdImage instance,
param: resource|GdImage|false $image A value to check the type for.

wp_imagecreatetruecolor( $width, $height )   X-Ref
Creates a new GD image resource with transparency support.

return: resource|GdImage|false The GD image resource or GdImage instance on success.
param: int $width  Image width in pixels.
param: int $height Image height in pixels.

wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height )   X-Ref
Based on a supplied width/height example, returns the biggest possible dimensions based on the max width/height.

return: int[] {
param: int $example_width  The width of an example embed.
param: int $example_height The height of an example embed.
param: int $max_width      The maximum allowed width.
param: int $max_height     The maximum allowed height.

wp_max_upload_size()   X-Ref
Determines the maximum upload size allowed in php.ini.

return: int Allowed upload size.

wp_get_image_editor( $path, $args = array()   X-Ref
Returns a WP_Image_Editor instance and loads file into it.

return: WP_Image_Editor|WP_Error The WP_Image_Editor object on success,
param: string $path Path to the file to load.
param: array  $args Optional. Additional arguments for retrieving the image editor.

wp_image_editor_supports( $args = array()   X-Ref
Tests whether there is an editor that supports a given mime type or methods.

return: bool True if an eligible editor is found; false otherwise.
param: string|array $args Optional. Array of arguments to retrieve the image editor supports.

_wp_image_editor_choose( $args = array()   X-Ref
Tests which editors are capable of supporting the request.

return: string|false Class name for the first editor that claims to support the request.
param: array $args Optional. Array of arguments for choosing a capable editor. Default empty array.

wp_plupload_default_settings()   X-Ref
Prints default Plupload arguments.


wp_prepare_attachment_for_js( $attachment )   X-Ref
Prepares an attachment post object for JS, where it is expected
to be JSON-encoded and fit into an Attachment model.

return: array|void {
param: int|WP_Post $attachment Attachment ID or object.

wp_enqueue_media( $args = array()   X-Ref
Enqueues all scripts, styles, settings, and templates necessary to use
all media JS APIs.

param: array $args {

get_attached_media( $type, $post = 0 )   X-Ref
Retrieves media attached to the passed post.

return: WP_Post[] Array of media attached to the given post.
param: string      $type Mime type.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.

get_media_embedded_in_content( $content, $types = null )   X-Ref
Checks the HTML content for an audio, video, object, embed, or iframe tags.

return: string[] Array of found HTML media elements.
param: string   $content A string of HTML which might contain media elements.
param: string[] $types   An array of media types: 'audio', 'video', 'object', 'embed', or 'iframe'.

get_post_galleries( $post, $html = true )   X-Ref
Retrieves galleries from the passed post's content.

return: array A list of arrays, each containing gallery data and srcs parsed
param: int|WP_Post $post Post ID or object.
param: bool        $html Optional. Whether to return HTML or data in the array. Default true.

get_post_gallery( $post = 0, $html = true )   X-Ref
Checks a specified post's content for gallery and, if present, return the first

return: string|array Gallery data and srcs parsed from the expanded shortcode.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
param: bool        $html Optional. Whether to return HTML or data. Default is true.

get_post_galleries_images( $post = 0 )   X-Ref
Retrieves the image srcs from galleries from a post's content, if present.

return: array A list of lists, each containing image srcs parsed.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.

get_post_gallery_images( $post = 0 )   X-Ref
Checks a post's content for galleries and return the image srcs for the first found gallery.

return: string[] A list of a gallery's image srcs in order.
param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.

wp_maybe_generate_attachment_metadata( $attachment )   X-Ref
Maybe attempts to generate attachment metadata, if missing.

param: WP_Post $attachment Attachment object.

attachment_url_to_postid( $url )   X-Ref
Tries to convert an attachment URL into a post ID.

return: int The found post ID, or 0 on failure.
param: string $url The URL to resolve.

wpview_media_sandbox_styles()   X-Ref
Returns the URLs for CSS files used in an iframe-sandbox'd TinyMCE media view.

return: string[] The relevant CSS file URLs.

wp_register_media_personal_data_exporter( $exporters )   X-Ref
Registers the personal data exporter for media.

return: array[] Updated array of personal data exporters.
param: array[] $exporters An array of personal data exporters, keyed by their ID.

wp_media_personal_data_exporter( $email_address, $page = 1 )   X-Ref
Finds and exports attachments associated with an email address.

return: array {
param: string $email_address The attachment owner email address.
param: int    $page          Attachment page number.

_wp_add_additional_image_sizes()   X-Ref
Adds additional default image sub-sizes.

These sizes are meant to enhance the way WordPress displays images on the front-end on larger,
high-density devices. They make it possible to generate more suitable `srcset` and `sizes` attributes
when the users upload large images.

The sizes can be changed or removed by themes and plugins but that is not recommended.
The size "names" reflect the image dimensions, so changing the sizes would be quite misleading.


wp_show_heic_upload_error( $plupload_settings )   X-Ref
Callback to enable showing of the user error when uploading .heic images.

return: array[] Modified settings for Plupload.js.
param: array[] $plupload_settings The settings for Plupload.js.

wp_getimagesize( $filename, ?array &$image_info = null )   X-Ref
Allows PHP's getimagesize() to be debuggable when necessary.

return: array|false Array of image information or false on failure.
param: string $filename   The file path.
param: array  $image_info Optional. Extended image information (passed by reference).

wp_get_avif_info( $filename )   X-Ref
Extracts meta information about an AVIF file: width, height, bit depth, and number of channels.

return: array {
param: string $filename Path to an AVIF file.

wp_get_webp_info( $filename )   X-Ref
Extracts meta information about a WebP file: width, height, and type.

return: array {
param: string $filename Path to a WebP file.

wp_get_loading_optimization_attributes( $tag_name, $attr, $context )   X-Ref
Gets loading optimization attributes.

This function returns an array of attributes that should be merged into the given attributes array to optimize
loading performance. Potential attributes returned by this function are:
- `loading` attribute with a value of "lazy"
- `fetchpriority` attribute with a value of "high"
- `decoding` attribute with a value of "async"

If any of these attributes are already present in the given attributes, they will not be modified. Note that no
element should have both `loading="lazy"` and `fetchpriority="high"`, so the function will trigger a warning in case
both attributes are present with those values.

return: array Loading optimization attributes.
param: string $tag_name The tag name.
param: array  $attr     Array of the attributes for the tag.
param: string $context  Context for the element for which the loading optimization attribute is requested.

wp_omit_loading_attr_threshold( $force = false )   X-Ref
Gets the threshold for how many of the first content media elements to not lazy-load.

This function runs the {@see 'wp_omit_loading_attr_threshold'} filter, which uses a default threshold value of 3.
The filter is only run once per page load, unless the `$force` parameter is used.

return: int The number of content media elements to not lazy-load.
param: bool $force Optional. If set to true, the filter will be (re-)applied even if it already has been before.

wp_increase_content_media_count( $amount = 1 )   X-Ref
Increases an internal content media count variable.

return: int The latest content media count, after the increase.
param: int $amount Optional. Amount to increase by. Default 1.

wp_maybe_add_fetchpriority_high_attr( $loading_attrs, $tag_name, $attr )   X-Ref
Determines whether to add `fetchpriority='high'` to loading attributes.

return: array Updated loading optimization attributes for the element.
param: array  $loading_attrs Array of the loading optimization attributes for the element.
param: string $tag_name      The tag name.
param: array  $attr          Array of the attributes for the element.

wp_high_priority_element_flag( $value = null )   X-Ref
Accesses a flag that indicates if an element is a possible candidate for `fetchpriority='high'`.

return: bool Returns true if high-priority element was marked already, otherwise false.
param: bool $value Optional. Used to change the static variable. Default null.



Generated : Fri Apr 26 08:20:02 2024 Cross-referenced by PHPXref