WordPress at a glance

the_attachment_link() WP 1.0

Display an attachment page link using an image or icon.

Works based on: wp_get_attachment_link()
✈ 1 time = 0.00291s = very slow | 50000 times = 5.22s = fast PHP 7.1.2, WP 4.7.3

No Hooks.

Return

Nothing (null).

Usage

the_attachment_link( $id, $fullsize, $deprecated, $permalink );
$id(int/WP_Post)
Post ID or post object.
Default: 0
$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

Code of the_attachment_link: wp-includes/post-template.php VER 4.9.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);
}

Related Functions

From tag: Link (tag A in HTML)

More from category: Attachments (Media files)

More from Template Tags: Posts, Pages, ...

No comments
    Hello, !     Log In . Register