Ticket #4699: category_permastruct_attachment.diff

File category_permastruct_attachment.diff, 1.2 kB (added by ryan, 4 months ago)
  • wp-includes/query.php

    old new  
    998998                } 
    999999 
    10001000                // Category stuff for nice URLs 
    1001                 if ( '' != $q['category_name'] ) { 
     1001                if ( '' != $q['category_name'] && !$this->is_singular ) { 
    10021002                        $reqcat = get_category_by_path($q['category_name']); 
    10031003                        $q['category_name'] = str_replace('%2F', '/', urlencode(urldecode($q['category_name']))); 
    10041004                        $cat_paths = '/' . trim($q['category_name'], '/'); 
  • wp-includes/link-template.php

    old new  
    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)
     182                if ( ctype_digit($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%')
    183183                        $name = 'attachment/' . $object->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker 
    184184                else 
    185185                        $name = $object->post_name;