How to migrate Mediavine Create to a new site

This has come up enough that I wanted to document this process. Mediavine does not provide a JSON or XML export process so it is up to us to migrate it manually. These migrations almost always happen for me when I am taking recipes from the live site and moving them to the staging site where I am re-doing someones theme.

Easy Way (~$50)

Live site:

  • Purchase WP DB Migrate PRO (not an affiliate link)
  • Install and add serial number on your live site.
  • Click Migrate
  • Click Export Database
  • Tables – Export only selected tables below:
    • wp_mv_images
    • wp_mv_nutrition
    • wp_mv_products
    • wp_mv_products_map
    • wp_mv_relations
    • wp_mv_reviews
    • wp_mv_revisions (optional?)
    • wp_mv_settings
    • wp_mv_shapes
    • wp_mv_supplies
      • (basically wp_mv_*)
  • Post Types – Export only post types selected below
    • mv_create
  • Leave advanced options alone
  • Custom Find & Replace
    • For the URL and install folder put in your staging URL formatted like it is on the plugin page, the easiest way to get this is from the plugin installed on your staging site.

Staging Site:

  • Install and add serial number this should not count against your installs if it is setup as a staging site.
  • Migrate – REPLACE THIS SITE WITH ANOTHER SITE – Import Database
  • Choose the sql.gz file you created from the live site.
  • Backup the database before running the import
    • The easiest is a full backup
    • the simplest is to backup just what you are replacing.
  • Standard Find & Replace
    • If you did this right before it should look like how your site is setup.
  • Custom Find & Replace
    • If you have not done your find and replace properly now is the chance to replace the URL and install location.

FAQ:

What about my images?

For your images I personally do a tools-export-wordpress-media to get an XML of the URL’s and have that import onto the live site.

What about the posts associated with the cards?

Tools – export – posts and select the date range. Or you can use wp db migrate pro again!

What is the free advanced way?

Backup both sites first and then use phpMyAdmin and export the above listed tables from your live site. On your staging site then drop those tables and re-import the sql.gz of those tables to have the latest data. You will still need to migrate the image files as well.

How to install youtube-dl on a chromebook

  • Install Termux
  • Enable storage access termux-setup-storage
  • Install Python
    • pkg install python ffmpeg
  • (optional upgrade pip)
    • pip --install upgrade pip
  • Install youtube-dl
    • pip --install youtube-dl
  • Navigate to your downloads directory
    • cd storage/downloads
  • Download your youtube video (Make sure you are in downloads directory so you can write the file!)
    • youtube-dl https://youtu.be/kJQP7kiw5Fk
    • You can paste with ctrl+alt+v into termux
    • You can pass the command –restrict-filenames to have clean file names without spaces for example: youtube-dl --restrict-filenames https://youtu.be/kJQP7kiw5Fk
  • Upgrade everything after it has been a while or when you encounter problems
    • pip install --upgrade pip youtube-dl
  • Updated 2020-04-07 to get ffmpeg from the archive and not pip.

WordPress alert when you are on the staging site.

Recently I accidentally overwrote my Production site when I thought I was on the staging site so after a bit of googling I came up with this solution. If you are on WordPress you can just paste this at the end of your functions.php for your theme. This could also probably be turned into a very simple plugin.

// Alert on Staging Site
// http://stackoverflow.com/questions/6522023/php-if-domain
$host = $_SERVER['HTTP_HOST'];
if ($host != 'XXXXXXXXXX.com') {
function staging_admin_error_notice()
{
$class = "error";
$message = "You are on the staging site.";
echo"<div class=\"$class\"> <h1>$message</h1></div>";
}
add_action('admin_notices', 'staging_admin_error_notice');
}