Skip to content
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/wp-includes/link-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,13 @@ function get_attachment_link( $post = null, $leavename = false ) {
global $wp_rewrite;

$link = false;
$post = get_post( $post );

// If wp_attachment_pages_enabled is disable get_attachment_link should return attachment url.
if ( $post && '0' === get_option( 'wp_attachment_pages_enabled' ) ) {
return wp_get_attachment_url( $post->ID );
}

$post = get_post( $post );
$force_plain_link = wp_force_plain_post_permalink( $post );
$parent_id = $post->post_parent;
$parent = $parent_id ? get_post( $parent_id ) : false;
Expand Down
Loading