adjacent_image_link()WP 2.5.0

Displays next or previous image link that has the same post parent.

Retrieves the current attachment object from the $post global.

No Hooks.

Return

null. Nothing (null).

Usage

adjacent_image_link( $prev, $size, $text );
$prev(true|false)
Whether to display the next (false) or previous (true) link.
Default: true
$size(string|int[])
Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order).
Default: 'thumbnail'
$text(true|false)
Link text.
Default: false

Changelog

Since 2.5.0 Introduced.

adjacent_image_link() code WP 6.5.3

function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
	echo get_adjacent_image_link( $prev, $size, $text );
}