[wp-trac] Re: [WordPress Trac] #3757: Uploads to post-new.php don't
get associated with the post
WordPress Trac
wp-trac at lists.automattic.com
Thu Feb 15 01:53:17 GMT 2007
#3757: Uploads to post-new.php don't get associated with the post
----------------------------------------------------+-----------------------
Reporter: JBoyd | Owner: mdawaffe
Type: defect | Status: reopened
Priority: normal | Milestone: 2.1.1
Component: Administration | Version: 2.1
Severity: normal | Resolution:
Keywords: images uploader write has-patch commit |
----------------------------------------------------+-----------------------
Comment (by mdawaffe):
First Part = regex fix that fixes fix_attachment_link() which provides the
the following functionality.
When a post is saved, WP looks through the post content to see if there
are any attachment links that do not adhere to the permalink structure.
If it finds any, it fixes the link and also re-parents them if the
attachment is an orphan.
Second Part = logic fix that fixes the following bug. (To reproduce, must
follow exact order.)
1. Go to post-new.php.
1. Write a post.
1. Allow autosave to fire.
1. Upload image. Do NOT send image to editor. Just upload it.
1. Publish.
1. Observe that uploaded image still has negative ID. (Easy to see since
it is not available in that post's "Browse" tab, only in the "Browse All"
Tab.)
If we include the regex fix in 2.1.1 but not the fix for the above bug,
images uploaded via the above steps will have negative ID. Consequences:
1. Not associated with post and no valid post_parent object.
1. No permalink.
1. ?attachment_id=xxx link will generate 404 to non-logged in users due
to WP_Query oddity.
BUT, if such an orphaned image is Sent to Editor, fix_attachment_links()
(which will now work), will re-parent the image and fix the above
consequences ''for that image only''.
--
Ticket URL: <http://trac.wordpress.org/ticket/3757#comment:13>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list