Media: Add `$attr` to the `wp_get_attachment_link` filter.

Props danielbachhuber.
Fixes #40155.



git-svn-id: https://develop.svn.wordpress.org/trunk@44471 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2019-01-08 09:08:06 +00:00
parent 801e193ae0
commit fbabf54a72
1 changed files with 3 additions and 1 deletions

View File

@ -1602,6 +1602,7 @@ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals
* Filters a retrieved attachment page link. * Filters a retrieved attachment page link.
* *
* @since 2.7.0 * @since 2.7.0
* @since 5.1.0 Added the $attr parameter.
* *
* @param string $link_html The page link HTML output. * @param string $link_html The page link HTML output.
* @param int $id Post ID. * @param int $id Post ID.
@ -1610,8 +1611,9 @@ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals
* @param bool $permalink Whether to add permalink to image. Default false. * @param bool $permalink Whether to add permalink to image. Default false.
* @param bool $icon Whether to include an icon. Default false. * @param bool $icon Whether to include an icon. Default false.
* @param string|bool $text If string, will be link text. Default false. * @param string|bool $text If string, will be link text. Default false.
* @param array|string $attr Array or string of attributes. Default empty.
*/ */
return apply_filters( 'wp_get_attachment_link', "<a href='" . esc_url( $url ) . "'>$link_text</a>", $id, $size, $permalink, $icon, $text ); return apply_filters( 'wp_get_attachment_link', "<a href='" . esc_url( $url ) . "'>$link_text</a>", $id, $size, $permalink, $icon, $text, $attr );
} }
/** /**