WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Two database entries per post? (9 posts)

  1. roro
    Member
    Posted 7 years ago #

    When I post a new entry on my blog (wordpress 2.x), two entries are stored on my database, (wp_posts) the usual one and another for the ALT i used on the image (is a photoblog).

    Why is this happening? Im the only one with this problem?

  2. MichaelH
    Member
    Posted 7 years ago #

    Are you experiencing a problem?

    The image normally creates another entry into wp_posts.

  3. roro
    Member
    Posted 7 years ago #

    No, not a problem, I just surprised and want to know if this is normal, im using wp since it was b2 and just upgrade from wp 1.2 and didnt expected that.

    thanks for the reply.

  4. MichaelH
    Member
    Posted 7 years ago #

    Actually I should point out that each image, even if not attached to a post, gets an entry in wp_posts.

    Have fun with the new and improved WordPress.

  5. roro
    Member
    Posted 7 years ago #

    so if I upload a photo with another script or ftp, i only get one entry per post?

    because i really dont get the point of this, sorry im a control freak :)

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    If you upload a file via the Write Post page's file uploader, it creates an entry in the posts table. This is a fake post, used to hold meta information about the file. It will have a post_status of "attachment" or something like that. You can safely ignore it, that's what it is supposed to do.

    In the case of uploading pictures, the post entry holds info like the size of the picture, the location of the auto-generated thumbnail, the description you gave it, etc.

  7. Chris_K
    Member
    Posted 7 years ago #

    Part of being a control freak is understanding what it is you feel the urge to control.

    As noted, with WP 2.x and the advent of the new image management "stuff", uploaded images get their own record in wp_posts. Yes, it is intentional.

    You certainly are not forced to use the built-in image uploader. There are several plugins that replace it and, of course, ftp and the knowledge of how to craft a simple <img> tag are also options.

    But I'll admit this is the most unusual reason given for not using it I've ever seen here. :-)

  8. roro
    Member
    Posted 7 years ago #

    Well, in case i want to migrate to another CMS I find more complicated with this "extra" entries on the post table.

    I like my databases easy to modify or export etc.

    Thanks to all, this post is now resolved!

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    roro: Not all that complicated. Just add a where clause to filter out the post_status = 'attachment'. Or export the thing as a big RSS feed or something. Considering the effort involved to migrate directly to anything else anyway (custom queries and such), it's not all that big of a deal.

Topic Closed

This topic has been closed to new replies.

About this Topic