Title: {$adjacent}_image_link
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( “{$adjacent}_image_link”, string $output, int $attachment_id, string|int[] $size, string $text )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#wp--skip-link--target)

Filters the adjacent image link.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#description)󠁿

The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency,
either ‘next’, or ‘previous’.

Possible hook names include:

 * `next_image_link`
 * `previous_image_link`

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#parameters)󠁿

 `$output`string

Adjacent image HTML markup.

`$attachment_id`int

Attachment ID

`$size`string|int[]

Requested image size. Can be any registered image size name, or an array of width
and height values in pixels (in that order).

`$text`string

Link text.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#source)󠁿

    ```php
    return apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/media.php#L3993)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/media.php#L3993-L3993)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#related)󠁿

| Used by | Description | 
| [get_adjacent_image_link()](https://developer.wordpress.org/reference/functions/get_adjacent_image_link/)`wp-includes/media.php` |

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

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/adjacent_image_link/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fadjacent_image_link%2F)
before being able to contribute a note or feedback.