WordPress.org

Ready to get started?Download WordPress

Forums

Automatically adding post-slugs to imported entrie (8 posts)

  1. offline
    Member
    Posted 10 years ago #

    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 http://offlineblog.com/backlog/2004/04/ 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?

  2. offline
    Member
    Posted 10 years ago #

    Any required imports?

  3. codergurl
    Member
    Posted 10 years ago #

    Oh, I'm sorry. I posted the code wrong. It should work now. :)

  4. Stevarino
    Member
    Posted 10 years ago #

    Nice code. :)

  5. offline
    Member
    Posted 10 years ago #

    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?

  6. offline
    Member
    Posted 10 years ago #

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

  7. offline
    Member
    Posted 10 years ago #

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

  8. offline
    Member
    Posted 10 years ago #

    (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 :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.