The next_image_link() WordPress PHP function displays the next image link that has the same post parent.
Usage
next_image_link( $size, $text )
Example: next_image_link( 'medium', 'Next Image' )
Parameters
$size
(string|int) – Optional. Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default: ‘thumbnail’.$text
(string|false) – Optional. Link text. Default: false.
More information
See WordPress Developer Resources: next_image_link
Examples
Basic Usage
Display the next image link with the default thumbnail size and no link text.
<div class="alignright"> next_image_link(); </div>
Custom Image Size
Display the next image link with a custom image size (200×200 pixels).
next_image_link( array( 200, 200 ) );
Custom Link Text
Display the next image link with custom link text.
next_image_link( 'thumbnail', 'View Next Image' );
Display Next Image Link with a Specific Size
Display the next image link with the ‘medium’ size and default link text.
next_image_link( 'medium' );
Combine Custom Image Size and Link Text
Display the next image link with a custom image size (300×300 pixels) and custom link text.
next_image_link( array( 300, 300 ), 'Go to Next Image' );