WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #13429, comment 43


Ignore:
Timestamp:
03/08/2012 01:36:06 AM (6 years ago)
Author:
benz001
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13429, comment 43

    initial v1  
    44I don't think the place to fix this bug is in media.php, unless it's to stop the rel="attachment" attribute getting added in the first place, and I can't see an obvious way to decide when and when not to add that attribute.
    55
    6 So the other way to attack it is via the _fix_attachment_links( ) function in /wp-admin/includes/post.php.
     6Another way to attack it is via the _fix_attachment_links( ) function in /wp-admin/includes/post.php.
    77
    8 '''Here's the clue''': If you revert this function to the one in wordpress 2.8 release the correct behaviour returns.
    9 
    10 The change that triggers the error looks like it's the addition of the preg_replace_callback
     8The trigger for the error looks like it's the preg_replace_callback
    119{{{
    1210                 $_fix_attachment_link_id = $id;
     
    1614If I follow this correctly it's completely rewriting the href attribute by calling into get_attachment_link() in the callback function.
    1715So any link with rel="attachment" and a parsable ID in that rel anywhere in the post content will get destroyed by this every time a post is saved.
     16
     17Perhaps the solution is to check the url more closely to see if it is in fact a link to an attachment before doing the callback??