L
L
ligisayan2021-06-17 11:46:32
WordPress
ligisayan, 2021-06-17 11:46:32

Why does it display a template page instead of links when viewing media files (pictures)?

Hello!
For some reason, when viewing a media file on my site, instead of a link to the file, it leads to a template page along the path
wp-includes\post-template.php
and is formed in this way

$p = '<p class="attachment">';
// Show the medium sized image representation of the attachment if available, and link to the raw file.
$p .= wp_get_attachment_link( 0, 'medium', false );
$p .= '</p>';


How can I fix it so that by default when viewing pictures, a link to a file is displayed, and not a page template?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pLavrenov, 2021-06-17
@pLavrenov

The reason is obvious wp_get_attachment_link

Retrieve an attachment page link using an image or icon, if possible.

wp_get_attachment_image_url

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question