WordPress.org

Make WordPress Core

Ticket #6280: 6280.diff

File 6280.diff, 767 bytes (added by andy, 10 years ago)

use explicit attachment permalink marker for int names

  • wp-includes/link-template.php

     
    179179                        $parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
    180180                else
    181181                        $parentlink = get_permalink( $object->post_parent );
     182                if ( ctype_digit($object->post_name) )
     183                        $name = 'attachment/' . $object->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
     184                else
     185                        $name = $object->post_name;
    182186                if (strpos($parentlink, '?') === false)
    183                         $link = trailingslashit($parentlink) . $object->post_name . '/';
     187                        $link = trailingslashit($parentlink) . $name . '/';
    184188        }
    185189
    186190        if (! $link ) {