How does uploads work?
-
Does anyone know if a new attachment is only a new wp_post record?
I am trying to do an automatic upload engine. But my images isn’t opening like the other normal attachments. I can access normal wp attachments by “pagename/imagename”. But this structure seems not work for automatic attachments. Every new image is being redirects to 404.
So I decided to ask it on forum to understand the proccess to create a new attachment.
-
Not much help here but to maybe show you a plugin that might help understand:
Thank you very much for your help =)
I tested it and that is what happens:
When we upload an image through add-from-server tab, the new image is attached to the page and the image appears on gallery tab.
Looking at the new attachment entry on wp_posts table I noticed that post_parent field was setted to the page’s id I am editing. But I still can’t access the image through pagename/imagename permalink.Whether I insert this new image on page I can access the image through pagename/imagename.
So what I find is:
A new wp_post entry isn’t enough to create a new attachment, and the page_parent field value isn’t enought to WP find the image through the post permalink.So, what else happens when an image is attached to a post?
– upload file to server
– new post entry where post_type is ‘attachment’ and post_parent is page’s id which we are editing
– ? (what else?)I still looking for a way to create a permalink to access my images. Any help is very appreciated. =)
It’s not making any sense for me.. can anyone help?
Once a wp_post entry looks like another one (only changing the fields id and post_name), what can take WP find an attachment by name (domain.com/pagename/imagename), but not the other one?
@michaelh: Do you know why an image listed in gallery tab (when editing a page), but not inserted yet, cannot be accessed by a permalink but another image which had already been inserted on this same page can be access by a permalink?
I mean, what does WP check before load the image.php? What is the diference on database between those two images?
Nobody knows answer me? =( really?
Where else can I get some help with it?
The topic ‘How does uploads work?’ is closed to new replies.