WordPress.org

Ready to get started?Download WordPress

Forums

Post id number wrong on import (8 posts)

  1. cheaper
    Member
    Posted 6 years ago #

    Hello

    If you use the export link to move your posts to a new server.

    Stop right there

    If you use this function it changes all your post id,s
    So if you already have pages in google such as blahblah/234 it will change to blahblah/36 or whatever

    As you are changing servers you keep your permalinks the same.

    I have just had to redirect 301 70 posts, as if you write a post in your new location and your next id is 91 and you already have Post out there with id 91 your old post will now point to the new one regardless of the title of the post.

    Just my bit to keep anyone from having to go through this bloody hassle.

    My fix for this was to change the old permalink structure from

    /%postname%/%year%/%monthnum%/%day%/%post_id%

    to /%postname%/%year%/%monthnum%/%day%/

    thus taking the ID out of the loop and then redirect all the old posts that were in googles index to to the new permalinsk structure

    If any one has a better idea i would like to know..

    Kev

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

    Most people don't put the post ID into the permalink structure, so this is generally a non-issue.

    But yes, ID numbers are not preserved with an export/import operation. If you want to preserve ID numbers, you need a full database dump and restore.

  3. rob101
    Member
    Posted 6 years ago #

    Hi Cheaper

    Many thanks for bringing this to my attention. I'm just setting up a WordPress blog and was going to use
    mydomain.com/postId/article,
    so now I guess I'll have to use
    mydomain.com/year/article

    Is there anything wrong with just using %year% in a permalink, and not %month% or %day%? Apart from making sure a years worth of posts don't repeat the same article name?

    And I have seen many blogs using just PostID, so I think there should at least be a warning when you try to use them.
    I must have asked about 5 times if anyone could see any problems just using PostID, and this was the first time I saw this problem.

  4. simosx
    Member
    Posted 6 years ago #

    The export writes the post_id of each post. It's the problem of the import to actually preserve the original post_id.

  5. powerseller2006
    Member
    Posted 6 years ago #

    Actually I fixed that: You need to use phpmyadmin or any other way to run a query on your database.

    In the table wp_posts you find these fields: "ID" and "guid"

    "ID" have the post's id number and "guid" have the whole URL. The field "ID" was changed after the import but the field "guid" remains with the old data.

    EXAMPLE
    In your old database: ID="58" and guid="http://www.yoursite.com/?p=58"

    but in the new database: ID="66" and guid="http://www.yoursite.com/?p=58" (Yes, it's still 58)

    So run a query to chop that part of "guid" where the old number is and replace "ID" with that number.

    If there's somebody who don't know how to do it, post a reply and I will post the query I used.

    Good Luck

  6. Konan87
    Member
    Posted 5 years ago #

    Hey powerseller 2006, could you please post the query? Thx!

  7. powerseller2006
    Member
    Posted 5 years ago #

    Hi, Sorry I didn't check this site lately. You know what? Actually my "solution" brought me more problems.

    What I did was good for the posts, but the categories, tags, and messages got all messed up. They all point to the new ID and when I restored the old ID... you get the picture?

    I only have 112 posts so I'm fixing every one by hand.

    If you want to have more mess than you already have, let me know and I'll give you some help.

  8. Justin Korn
    Member
    Posted 5 years ago #

    powerseller2006 - can you still please post your query? perhaps it can be modified to make it work properly.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic