_wp_post_thumbnail_class_filter(
array $attr
)
:
arrayAdds a 'wp-post-image' class to post thumbnail thumbnails
Uses the begin_fetch_post_thumbnail_html and end_fetch_post_thumbnail_html action hooks to
dynamically add/remove itself so as to only filter post thumbnail thumbnails
Parameters
| Name |
Type |
Description |
| $attr |
array |
Attributes including src, class, alt, title |
Returns
Details
- since
- 2.9.0
_wp_post_thumbnail_class_filter_add(
$attr
)
:
Adds _wp_post_thumbnail_class_filter to the wp_get_attachment_image_attributes filter
Parameters
| Name |
Type |
Description |
| $attr |
|
|
Details
- since
- 2.9.0
_wp_post_thumbnail_class_filter_remove(
$attr
)
:
Removes _wp_post_thumbnail_class_filter from the wp_get_attachment_image_attributes filter
Parameters
| Name |
Type |
Description |
| $attr |
|
|
Details
- since
- 2.9.0
add_image_size(
$name, $width
=
0, $height
=
0, $crop
=
false
)
:
Registers a new image size
Parameters
| Name |
Type |
Description |
| $name |
|
|
| $width |
|
|
| $height |
|
|
| $crop |
|
|
adjacent_image_link(
bool $prev
=
true, $size
=
thumbnail, $text
=
false
)
:
Display next or previous image link that has the same post parent.
Retrieves the current attachment object from the $post global.
Parameters
| Name |
Type |
Description |
| $prev |
bool |
Optional. Default is true to display previous link, true for next. |
| $size |
|
|
| $text |
|
|
Details
- since
- 2.5.0
gallery_shortcode(
array $attr
)
:
stringThe Gallery shortcode.
This implements the functionality of the Gallery Shortcode for displaying
WordPress images on a post.
Parameters
| Name |
Type |
Description |
| $attr |
array |
Attributes attributed to the shortcode. |
Returns
Details
- since
- 2.5.0
gd_edit_image_support(
string $mime_type
)
:
boolCheck if the installed version of GD supports particular image type
Parameters
| Name |
Type |
Description |
| $mime_type |
string |
|
Returns
Details
- since
- 2.9.0
get_attachment_taxonomies(
int|array|object $attachment
)
:
arrayRetrieve taxonomies attached to the attachment.
Parameters
| Name |
Type |
Description |
| $attachment |
int|array|object |
Attachment ID, Attachment data array, or Attachment data object. |
Returns
Details
- since
- 2.5.0
get_image_tag(
int $id, string $alt, string $title, string $align, string $size
=
medium
)
:
stringAn
![]()
tag for an image attachment, scaling it down if requested.
The filter 'get_image_tag_class' 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 '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.
Parameters
| Name |
Type |
Description |
| $id |
int |
Attachment ID. |
| $alt |
string |
Image Description for the alt attribute. |
| $title |
string |
Image Description for the title attribute. |
| $align |
string |
Part of the class name for aligning the image. |
| $size |
string |
Optional. Default is 'medium'.
|
Returns
Details
- since
- 2.5.0
- uses
- \apply_filters()
- uses
- \apply_filters()
get_intermediate_image_sizes(
)
:
arrayGet the available image sizes
Returns
Details
- since
- 3.0.0
image_constrain_size_for_editor(
int $width, int $height, string|array $size
=
medium
)
:
arrayScale 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' 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, 'editor_max_image_size' that will be called
on the calculated array for width and height, respectively. The second
parameter will be the value that was in the $size parameter. The returned
type for the hook is an array with the width as the first element and the
height as the second element.
Parameters
| Name |
Type |
Description |
| $width |
int |
Width of the image |
| $height |
int |
Height of the image |
| $size |
string|array |
Size of what the result image should be. |
Returns
Details
- since
- 2.5.0
- uses
- \wp_constrain_dimensions()
image_downsize(
int $id, array|string $size
=
medium
)
:
bool|arrayScale an image to fit a particular size (such as 'thumb' or 'medium').
Array with image url, width, height, and whether is intermediate size, in
that order is returned on success is returned. $is_intermediate is true if
$url is a resized image, false if it is the original.
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 '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 returned in the function. The first element being the URL
to the new image that was resized.
Parameters
| Name |
Type |
Description |
| $id |
int |
Attachment ID for image. |
| $size |
array|string |
Optional, default is 'medium'. Size of image, either array or string.
|
Returns
| Type |
Description |
| boolarray |
|
Details
- since
- 2.5.0
- uses
- \apply_filters()
image_get_intermediate_size(
int $post_id, array|string $size
=
thumbnail
)
:
bool|arrayRetrieve 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.
Parameters
| Name |
Type |
Description |
| $post_id |
int |
Attachment ID for image. |
| $size |
array|string |
Optional, default is 'thumbnail'. Size of image, either array or string.
|
Returns
| Type |
Description |
| boolarray |
|
Details
- see
- \add_image_size()
- since
- 2.5.0
image_hwstring(
int|string $width, int|string $height
)
:
stringRetrieve 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.
Parameters
| Name |
Type |
Description |
| $width |
int|string |
Optional. Width attribute value. |
| $height |
int|string |
Optional. Height attribute value. |
Returns
Details
- since
- 2.5.0
image_make_intermediate_size(
string $file, int $width, int $height, bool $crop
=
false
)
:
bool|arrayResize an image to make a thumbnail or intermediate size.
The returned array has the file size, the image width, and image height. The
filter 'image_make_intermediate_size' can be used to hook in and change the
values of the returned array. The only parameter is the resized file path.
Parameters
| Name |
Type |
Description |
| $file |
string |
File path. |
| $width |
int |
Image width. |
| $height |
int |
Image height. |
| $crop |
bool |
Optional, default is false. Whether to crop image to specified height and width or resize. |
Returns
| Type |
Description |
| boolarray |
|
Details
- since
- 2.5.0
image_resize(
string $file, int $max_w, int $max_h, bool $crop
=
false, string $suffix
=
null, string $dest_path
=
null, int $jpeg_quality
=
90
)
:
mixedScale down an image to fit a particular size and save a new copy of the image.
The PNG transparency will be preserved using the function, as well as the
image type. If the file going in is PNG, then the resized image is going to
be PNG. The only supported image types are PNG, GIF, and JPEG.
Some functionality requires API to exist, so some PHP version may lose out
support. This is not the fault of WordPress (where functionality is
downgraded, not actual defects), but of your PHP version.
Parameters
| Name |
Type |
Description |
| $file |
string |
Image file path. |
| $max_w |
int |
Maximum width to resize to. |
| $max_h |
int |
Maximum height to resize to. |
| $crop |
bool |
Optional. Whether to crop image or resize. |
| $suffix |
string |
Optional. File Suffix. |
| $dest_path |
string |
Optional. New image file path. |
| $jpeg_quality |
int |
Optional, default is 90. Image quality percentage. |
Returns
Details
- since
- 2.5.0
image_resize_dimensions(
int $orig_w, int $orig_h, int $dest_w, int $dest_h, bool $crop
=
false
)
:
bool|arrayRetrieve calculated resized dimensions for use in imagecopyresampled().
Calculate dimensions and coordinates for a resized image that fits within a
specified width and height. If $crop is true, the largest matching central
portion of the image will be cropped out and resized to the required size.
Parameters
| Name |
Type |
Description |
| $orig_w |
int |
Original width. |
| $orig_h |
int |
Original height. |
| $dest_w |
int |
New width. |
| $dest_h |
int |
New height. |
| $crop |
bool |
Optional, default is false. Whether to crop image or resize. |
Returns
| Type |
Description |
| boolarray |
|
Details
- since
- 2.5.0
img_caption_shortcode(
array $attr, string $content
=
null
)
:
stringThe Caption shortcode.
Allows a plugin to replace the content that would otherwise be returned. The
filter is 'img_caption_shortcode' and passes an empty string, the attr
parameter and the content parameter values.
The supported attributes for the shortcode are 'id', 'align', 'width', and
'caption'.
Parameters
| Name |
Type |
Description |
| $attr |
array |
Attributes attributed to the shortcode. |
| $content |
string |
Optional. Shortcode content. |
Returns
Details
- since
- 2.6.0
next_image_link(
string $size
=
thumbnail, string $text
=
false
)
:
stringDisplay next image link that has the same post parent.
Parameters
| Name |
Type |
Description |
| $size |
string |
Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text;
|
| $text |
string |
Optional, default is false. If included, link will reflect $text variable.
|
Returns
Details
- since
- 2.5.0
previous_image_link(
string $size
=
thumbnail, string $text
=
false
)
:
stringDisplay previous image link that has the same post parent.
Parameters
| Name |
Type |
Description |
| $size |
string |
Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text;
|
| $text |
string |
Optional, default is false. If included, link will reflect $text variable.
|
Returns
Details
- since
- 2.5.0
set_post_thumbnail_size(
$width
=
0, $height
=
0, $crop
=
false
)
:
Registers an image size for the post thumbnail
Parameters
| Name |
Type |
Description |
| $width |
|
|
| $height |
|
|
| $crop |
|
|
wp_constrain_dimensions(
int $current_width, int $current_height, int $max_width
=
0, int $max_height
=
0
)
:
arrayCalculates the new dimentions for a downsampled image.
If either width or height are empty, no constraint is applied on
that dimension.
Parameters
| Name |
Type |
Description |
| $current_width |
int |
Current width of the image. |
| $current_height |
int |
Current height of the image. |
| $max_width |
int |
Optional. Maximum wanted width. |
| $max_height |
int |
Optional. Maximum wanted height. |
Returns
Details
- since
- 2.5.0
wp_embed_defaults(
)
:
arrayCreate default array of embed parameters.
Returns
Details
- since
- 2.9.0
wp_embed_handler_googlevideo(
array $matches, array $attr, string $url, array $rawattr
)
:
stringThe Google Video embed handler callback. Google Video does not support oEmbed.
Parameters
| Name |
Type |
Description |
| $matches |
array |
The regex matches from the provided regex when calling {@link wp_embed_register_handler()}.
|
| $attr |
array |
Embed attributes. |
| $url |
string |
The original URL that was matched by the regex. |
| $rawattr |
array |
The original unmodified attributes. |
Returns
Details
- see
- \WP_Embed::register_handler()
- see
- \WP_Embed::shortcode()
wp_embed_register_handler(
$id, $regex, $callback, $priority
=
10
)
:
Register an embed handler. This function should probably only be used for sites that do not support oEmbed.
wp_embed_unregister_handler(
$id, $priority
=
10
)
:
Unregister a previously registered embed handler.
wp_expand_dimensions(
int $example_width, int $example_height, int $max_width, int $max_height
)
:
arrayBased on a supplied width/height example, return the biggest possible dimensions based on the max width/height.
Parameters
| Name |
Type |
Description |
| $example_width |
int |
The width of an example embed. |
| $example_height |
int |
The height of an example embed. |
| $max_width |
int |
The maximum allowed width. |
| $max_height |
int |
The maximum allowed height. |
Returns
Details
- since
- 2.9.0
- uses
- \wp_constrain_dimensions()
wp_get_attachment_image(
int $attachment_id, string $size
=
thumbnail, bool $icon
=
false, $attr
)
:
stringGet 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.
Parameters
| Name |
Type |
Description |
| $attachment_id |
int |
Image attachment ID. |
| $size |
string |
Optional, default is 'thumbnail'.
|
| $icon |
bool |
Optional, default is false. Whether it is an icon. |
| $attr |
|
|
Returns
Details
- see
- \add_image_size()
- since
- 2.5.0
- uses
- \apply_filters()
- uses
- \wp_get_attachment_image_src()
wp_get_attachment_image_src(
int $attachment_id, string $size
=
thumbnail, bool $icon
=
false
)
:
bool|arrayRetrieve an image to represent an attachment.
A mime icon for files, thumbnail or intermediate size for images.
Parameters
| Name |
Type |
Description |
| $attachment_id |
int |
Image attachment ID. |
| $size |
string |
Optional, default is 'thumbnail'.
|
| $icon |
bool |
Optional, default is false. Whether it is an icon. |
Returns
| Type |
Description |
| boolarray |
|
Details
- since
- 2.5.0
wp_imagecreatetruecolor(
int $width, int $height
)
:
\imageCreate new GD image resource with transparency support
Parameters
| Name |
Type |
Description |
| $width |
int |
Image width |
| $height |
int |
Image height |
Returns
Details
- since
- 2.9.0
wp_load_image(
string $file
)
:
resourceLoad an image from a string, if PHP supports it.
Parameters
| Name |
Type |
Description |
| $file |
string |
Filename of the image to load. |
Returns
| Type |
Description |
| resource |
|
Details
- since
- 2.1.0
wp_maybe_load_embeds(
)
:
Determines if default embed handlers should be loaded.
Checks to make sure that the embeds library hasn't already been loaded. If
it hasn't, then it will load the embeds library.
Details
- since
- 2.9.0
wp_oembed_add_provider(
string $format, string $provider, boolean $regex
=
false
)
:
Adds a URL format and oEmbed provider URL pair.
Parameters
| Name |
Type |
Description |
| $format |
string |
The format of URL that this provider can handle. You can use asterisks as wildcards. |
| $provider |
string |
The URL to the oEmbed provider. |
| $regex |
boolean |
Whether the $format parameter is in a regex format.
|
Details
- see
- \WP_oEmbed
- since
- 2.9.0
- uses
- \_wp_oembed_get_object()
wp_oembed_get(
string $url, array $args
)
:
stringAttempts to fetch the embed HTML for a provided URL using oEmbed.
Parameters
| Name |
Type |
Description |
| $url |
string |
The URL that should be embeded. |
| $args |
array |
Addtional arguments and parameters. |
Returns
Details
- see
- \WP_oEmbed
- since
- 2.9.0
- uses
- \_wp_oembed_get_object()
- uses
- \WP_oEmbed::get_html()