PHP code example of madebit / wordpress-data-migration
1. Go to this page and download the library: Download madebit/wordpress-data-migration library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
madebit / wordpress-data-migration example snippets
add_action('init', function () {
new DataMigration(get_template_directory() . '/migrations/');
});
namespace Madebit\WordpressDataMigration;
class DoThisAndThat extends \Madebit\WordpressDataMigration\AbstractMigration {
public function up()
{
// migrate data when migrating up
}
public function down()
{
// migrate data when migrating down
}
}
bash
touch migrations/CURRENT_VERSION
echo '0' > migrations/CURRENT_VERSION
bash
touch migrations/1-DoThisAndThat.php