• I’m fairly new to WordPress, but I’m a programmer and I’m doing quite a lot with WordPress on my local site. My plan is to maintain, edit, and enhance my site locally, then migrate to a live site from time to time.

    I’ve done this successfully a few times with Duplicator Pro. However, this deletes and/or overwrites the database. Does this mean that I’ll lose comments that people entered on the live site? Is there any migration solution that keeps comments on the live site?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I hate local development servers…

    Sounds like such a great idea but some wind up being such a very different environment that migrating makes little sense. Often the dev box is a WAMP server while the live host is Linux. You have differences and they can bite you.

    That said, it can be a great idea. I usually sandbox an under-development site on the host it will finally be located at. Fewer headaches. I don’t sandbox very much but some clients want that ability.

    If you want to create posts and pages (content) offline and then move it to the live site there are three methods I can recommend.

    1. The export module under tools on the donor site and the import module on the recipient site.
    2. A syndication plugin such as Syndicate out which uses XMLRPC on the recipient site.
    3. A RSS feed from the dev box to a feed importer on the recipient site.

    If you’re developing themes or plugins offline then you can move the whole package of theme or plugin files as a zip or a directory via FTP.

    Some migrator plugins overwrite the database while others ‘overlay’ instead. If you really want to preserve the comments you can try it with a backup in hand and you might want to export the present content using the export module on the recipient site as a secondary backup. If the migrate kills the comments then you’ll be able to restore via the import the content and/or recover from there if you need to via a backup.

    • This reply was modified 5 years, 10 months ago by JNashHawkins.
    Dion

    (@diondesigns)

    phpMyAdmin on your live site should solve your problem. Before you migrate the database from your local site, make copies of the _comments and _commentmeta tables on your live site. You can do that in phpMyAdmin by selecting your database, then clicking the Operations tab and using the “structure and data” and “drop table” options in the “copy table” section. Let’s say you copy _comments to _csave and _commentmeta to _cmetasave. Then migrate the database. After the migration is complete, copy _csave to _comments and _cmetasave to _commentmeta using the same procedure/options as above. You should repeat this process every time you want to do a migration.

    Note that I left off the table prefix in the table names. If the table prefix in wp_config.php is “wp_”, then the tables names would be, for example, wp_comments and wp_csave.

    This procedure assumes your migration application doesn’t drop, then re-create the database. It would be pretty stupid for the application to do that, but if you think it’s possible, make a backup of your entire live database before you do the above for the first time.

    I hate local development servers…

    Sounds like such a great idea but some wind up being such a very different environment that migrating makes little sense. Often the dev box is a WAMP server while the live host is Linux. You have differences and they can bite you.

    I am of the opposite opinion, and I see the above as a “sky is falling” scenario. The OS differences are negligible for the web-facing filesystem and database. Only the choice of web/db application and their versions will matter, and they are a minor issue at most for those who have their host manage the webserver and database applications. (This only applies to Linux hosting. I don’t accept clients who have Windows/IIS hosting.)

    I also prefer that clients use WAMP.MAMP/etc rather than something like LocalFlywheel/Bitnami. It’s much easier for them to understand how to manage things in the background (SSH tunneling…lol), and migration to the location of their choice is a whole lot simpler.

    There is also a lightweight way of using localhost that suits some of my sites.
    I develop and tune the content in localhost, then to deploy the new content on the public site I recreate the page/post on the live site, mostly a matter of copy and paste. It can be very efficient and timely.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘migrate to live: keep comments on live site?’ is closed to new replies.