Support » Fixing WordPress » Automatically adding post-slugs to imported entrie

  • I just realized that my backlog of entries from pre-WP days was imported without converting the entry titles into post-slugs. I didn’t really expect that this would be a problem, except that I’m using the permalink rewriting feature and it’s generating a blank section of the link (try going to and clicking on any entry except the first one and you’ll see what I mean — there’s an empty spot in the address bar)
    This means that the comments for the post are invisible.
    So, I could manually go through the whole list of entries and add titles, but I’m admittedly a bit lazy and would rather there was some simple way to do so.
    Anyone got an idea? Am I really the first to have this problem?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Any required imports?

    Oh, I’m sorry. I posted the code wrong. It should work now. 🙂

    Nice code. 🙂

    Not quite…
    There’s one small problem. When I try to run it, I get a SQL error as follows:

    Database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE post_name = ”’ at line 1]
    SELECT ID, post_title FROM WHERE post_name = ”

    I’m not a SQL ninja, but I do know enough to know that this looks just fine to me. I suspect that PHP’s strings might be the issue, but I don’t know enough PHP right off the top of my head to fix it.
    Is it possible that the ‘ character needs to be escaped?

    NEver mind… It’s more that $wpdb->posts isn’t returning a value.
    Where can i find the structure for that?

    Me again…
    Fixed it for ver. 1.2 (since the $wpdb->posts variable only exists in 1.3)
    Uploading changes to the Wiki.

    (or, I would, but I cannot either log in there nor can I create a new user — I get an invalid password or userID error no matter what I try)
    Sorry about the over-posting, folks — It’s early here, and it shows 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Automatically adding post-slugs to imported entrie’ is closed to new replies.