WordPress at Your Fingertips

the_attachment_link() WP 1.0

Display an attachment page link using an image or icon.

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.
$permalink(true|false)
Whether to include permalink.
Default: false

Changelog

Since 2.0.0 Introduced.

Code of the_attachment_link() WP 5.8

<?php
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 );
	}
}

From tag: Link (tag A in HTML)

More from category: Attachments (Media files)

More from Template Tags: Post Thumbnails

No comments
    Log In