Skip to main content

Name your own backup plugin on the migration wizard’s first step

Premium Beginner

The Migration Wizard’s first step backs up Benecaster’s own data before the import writes anything. That backup is narrow on purpose: your shows, tiers, subscribers and feed tokens, and nothing else. So when the wizard finds a whole-site backup plugin — UpdraftPlus or BackupBuddy out of the box — it names it and suggests taking a full site backup as well.

If the site runs a different whole-site backup tool, this recipe adds it, so the podcaster is pointed at the backup they actually use.

Detect the plugin by something it defines, such as a class or a constant, as the example does. The filter runs once every active plugin has loaded, and the active_plugins option is wrong for a network-activated plugin anyway.

Add whole-site backup tools only. Naming a second partial backup reinforces exactly the assumption the prompt exists to correct.

Leave the name untranslated — it is the plugin’s own name, and a translated one stops the podcaster recognising it in their menu. settingsUrl can be null: the wizard then names the plugin without a link, which beats a link to the wrong screen.

Returning [] removes the prompt. Do that only if you are sure the site has no whole-site backup worth mentioning — someone about to rewrite their subscriber list is the last person who should be talked out of one.

Code

<?php
add_filter( 'benecaster_migration_backup_plugins', function ( array $plugins ): array {
    // Detect by a symbol the plugin defines, not by an entry in
    // `active_plugins`: this runs on `admin_enqueue_scripts`, when every
    // active plugin has already loaded, and the option is a list of file
    // paths that is wrong for a network-activated plugin anyway.
    if ( ! class_exists( 'My_Backup_Plugin' ) ) {
        return $plugins;
    }

    $plugins[] = [
        'slug'        => 'my-backup-plugin',
        // Not translated: a plugin's own proper noun. A translated name
        // stops the podcaster recognising it in their own menu.
        'name'        => 'My Backup Plugin',
        // null is a correct answer. The wizard then names the plugin
        // without a link, which is better than linking somewhere wrong.
        'settingsUrl' => admin_url( 'admin.php?page=my-backup-plugin' ),
    ];

    return $plugins;
} );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →