Title: get_previous_image_link
Published: July 20, 2021
Last modified: February 24, 2026

---

# get_previous_image_link( string|int[] $size, string|false $text = false ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#changelog)

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

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

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

### 󠀁[See also](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#see-also)󠁿

 * [get_adjacent_image_link()](https://developer.wordpress.org/reference/functions/get_adjacent_image_link/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#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|falseoptional

Link text.

Default:`false`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_previous_image_link/?output_format=md#return)󠁿

 string Markup for previous image link.

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

    ```php
    function get_previous_image_link( $size = 'thumbnail', $text = false ) {
    	return get_adjacent_image_link( true, $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/6.9.4/src/wp-includes/media.php#L3881)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/media.php#L3881-L3883)

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

| Uses | 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.

  |

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

Displays previous image link that has the same post parent.

  |

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

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

## User Contributed Notes

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