the_attachment_link()
Display an attachment page link using an image or icon.
Uses: wp_get_attachment_link()
1 time — 0.00291 sec (very slow) | 50000 times — 5.22 sec (fast) | PHP 7.1.2, WP 4.7.3
No Hooks.
Return
null
. Nothing.
Usage
the_attachment_link( $id, $fullsize, $deprecated, $permalink );
- $id(int|WP_Post)
- Post ID or post object.
- $fullsize(true|false)
- Whether to use full size.
Default: false - $deprecated(true|false)
- Deprecated. Not used.
Default: false - $permalink(true|false)
- Whether to include permalink.
Default: false
Changelog
Since 2.0.0 | Introduced. |
Code of the_attachment_link() the attachment link WP 5.9.3
function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.5.0' ); } if ( $fullsize ) { echo wp_get_attachment_link( $id, 'full', $permalink ); } else { echo wp_get_attachment_link( $id, 'thumbnail', $permalink ); } }