Filter hook '{$adjacent}_image_link'

in WP Core File wp-includes/media.php at line 3983

View Source

{$adjacent}_image_link

Filter Hook
Description
Filters the adjacent image link. 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`

Hook Information

File Location wp-includes/media.php View on GitHub
Hook Type Filter
Line Number 3983

Hook Parameters

Type Name Description
string $output Adjacent image HTML markup.
int $attachment_id Attachment ID
string|int[] $size Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
string $text Link text.

Usage Examples

Basic Usage
<?php
// Hook into {$adjacent}_image_link
add_filter('{$adjacent}_image_link', 'my_custom_filter', 10, 4);

function my_custom_filter($output, $attachment_id, $size, $text) {
    // Your custom filtering logic here
    return $output;
}

Source Code Context

wp-includes/media.php:3983 - How this hook is used in WordPress core
<?php
3978  	 * @param int    $attachment_id Attachment ID
3979  	 * @param string|int[] $size    Requested image size. Can be any registered image size name, or
3980  	 *                              an array of width and height values in pixels (in that order).
3981  	 * @param string $text          Link text.
3982  	 */
3983  	return apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
3984  }
3985  
3986  /**
3987   * Displays next or previous image link that has the same post parent.
3988   *

PHP Documentation

<?php
/**
	 * Filters the adjacent image link.
	 *
	 * 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`
	 *
	 * @since 3.5.0
	 *
	 * @param string $output        Adjacent image HTML markup.
	 * @param int    $attachment_id Attachment ID
	 * @param string|int[] $size    Requested image size. Can be any registered image size name, or
	 *                              an array of width and height values in pixels (in that order).
	 * @param string $text          Link text.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/media.php
Related Hooks

Related hooks will be displayed here in future updates.