• Could really use some suggestions here – this is one I’ve never tried before.

    The old site was built on a really old version of WP with a custom theme. We changed hosting companies, and did a bit of reorganizing of the content. So, instead of importing the old files, I started from scratch with a fresh install of 3.2.1, upgraded to 3.3, and then installed Thesis. From there, I’ve added the pages and their content, done the initial configurations for the site and Thesis, and now want to get the blog posts imported in.

    But what I’ve got is a .SQL file, and all the help/codex files seem to suggest that to import this, I need a blank database – which, if I’m understanding this correctly, would require undoing everything I’ve already done.

    If I went about this backwards, well, I’ll take my licks but I’d really rather not have to redo all that.

    Is there any way to cull *just* the posts themselves from a .SQL file and import them into a fresh WP install without deleting everything that’s already been set up?

    Many thanks in advance –
    [Signature removed by moderator per forum rules.]

Viewing 15 replies - 1 through 15 (of 28 total)
  • If I were you, what I would do is, set up another WordPress install really quickly using the old database. I would do this on my local machine. It doesn’t have to be anything fancy, just install WP, dump your .sql in phpmyadmin, connect to it, that’s it. You will probably need to update the db, but that’s ok, that won’t affect your content.

    Once logged in, I would just export just the posts into an xml file.

    Then I would go to the new site and import them and then delete the one that you just set up.

    Thread Starter AnnieSisk

    (@anniesisk)

    That was exactly the idea I came up with after I posted but wanted to make sure there weren’t any simpler solutions I was overlooking. Thank you so much!

    Thread Starter AnnieSisk

    (@anniesisk)

    I’m really frustrated here. I did the localhost install successfully, finally, and then tried to dump the SQL into the new database. But what happened was it redirected to the client’s NEW site.

    I checked the localhost site’s wp-config.php file but it was just the way I’d edited it in the localhost install process.

    What’s going on? What did I do wrong, or fail to do? Shouldn’t it be installing the old site’s content into the new localhost site? Why is it redirecting to the active new site URL?

    I should also say this: when I tried to create a new subdomain on my site (dev.anniesisk.com) it ALSO redirected to the client’s new site, before I even dumped the SQL backup file into it. I’ve dumped the cache every time, so that’s not it. I just don’t understand why, whatever I do, I keep getting routed to the new active site.

    Thread Starter AnnieSisk

    (@anniesisk)

    I’m going to start a new thread about this to keep it cleaner. Mods, feel free to delete this and the post above.

    probably you are redirecting to the live-site because of following reasons:

    check your local/new database that you have dumped, check for wp_options table, in that table check for the siteurl entry under option_name field, just change that entry according to your local.

    Thread Starter AnnieSisk

    (@anniesisk)

    It’s localhost:8888/localdev – do I just substitute that for the URL? (I actually tried this before but I must have edited too much because the next time I got a database connection error when I tried to connect.)

    what URL are you using to open the index page/home page?? for e. g. https://localhost/myblog, whatever URL you are using to access your index page, you have to insert that URL in DB

    Thread Starter AnnieSisk

    (@anniesisk)

    Well, it’s Chrome so it strips out the https:// part but yes, https://localhost:8888/localdev. So I put that in where the URL is and we’re good… yes? And THANK YOU. This has been bugging the crap out of me for days. ??

    Add these two lines to the theme function file, immediately after the initial “<?php” line.

    update_option('siteurl','https://example.com/blog');
    update_option('home','https://example.com/blog');

    Use your own URL instead of example.com, obviously.

    use this plugin https://www.ads-software.com/extend/plugins/search-and-replace/

    find localhost:8888/localdev and replace with your new url.

    https://codex.www.ads-software.com/Changing_The_Site_URL

    hey, just one more thing, when you follow the Export and Import process, and if you can successfully import your all/selected post to your new server/blog, then please let me know your steps/processes, because i have issues in importing a posts.
    please see at
    https://www.ads-software.com/support/topic/not-able-to-import-wordpress-posts?replies=1#post-2534256

    Thread Starter AnnieSisk

    (@anniesisk)

    Pankaj, you mean functions.php, I’m assuming – in addition to Manoj’s suggestion, you mean? Or instead of? My new URL *is* localhost:8888/localdev – I’m getting redirected to the new live site. I’m not sure how this will help, because once I import the database, I get redirected to the new site and can’t access the local site, and everything gets replaced with the import file, right?

    Manoj, I’ll try! I’m not sure we have the same issues, though.

    Thread Starter AnnieSisk

    (@anniesisk)

    OK – I did as Manoj suggested. The only thing I changed was the siteurl as specified. I saved the file again, and then imported it in PHPMyAdmin. Before, when I imported the SQL file, it went perfectly (although I had the redirect issue). Now, I’m getting the following error:

    Error
    SQL query:
    
    # WordPress MySQL database backup
    #
    # Generated: Wednesday 28. December 2011 09:47 CST
    # Hostname: localhost
    # Database: <code>kevinhic_wrdp1</code>
    # --------------------------------------------------------
    # --------------------------------------------------------
    # Table: <code>wp_categories</code>
    # --------------------------------------------------------
    #
    # Delete any existing table <code>wp_categories</code>
    #
    DROP TABLE IF EXISTS  <code>wp_categories</code> ;
    
    MySQL said: 
    
    #1046 - No database selected

    But I haven’t changed anything in that line, so I don’t know what the problem is now.

    EDITED TO ADD: Does it have anything to do with the database name? It’s calling the old database but my localhost db is named ‘localdev.’ Not sure if that means anything.

    this is because you have not selected any database.

    first you need to create one database, and then in that empty database you need to import

    Thread Starter AnnieSisk

    (@anniesisk)

    EDITED: I created a new database and successfully imported the revised SQL file (edited the siteurl to https://localhost:8888/localdev per your instructions earlier). I pulled up the WP site and dashboard – it’s a nice blank WP with the default theme but there are no posts. How do I access the imported posts so I can export them to XML, which was the whole reason I started this process in the first place, LOL?

    i mean yes, in your localdev database, one which supporting your local version of WP, in that DB import,

    error may be because of you have not selected your localdev database and you are trying to import

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Importing Posts from Old WP Site Into New Site With SQL Backup File’ is closed to new replies.