Skip to content

Instantly share code, notes, and snippets.

@thadallender
Created November 3, 2016 02:32
Show Gist options
  • Save thadallender/7a6d7308ecae1aba9bf2f37090e01762 to your computer and use it in GitHub Desktop.
Save thadallender/7a6d7308ecae1aba9bf2f37090e01762 to your computer and use it in GitHub Desktop.
Sell Media Keyword Migration
<?php
/**
* Plugin Name: Sell Media Keyword Migration
* Plugin URI: http://graphpaperpress.com/
* Description: An extension for migrating keywords in Sell Media to attachments
* Version: 1.0.0
* Author: Graph Paper Press
* Author URI: http://graphpaperpress.com
* Author Email: support@graphpaperpress.com
* License: GPL
*/
/**
* Activate this plugin, then visit https://your-website.com/wp-admin/?sell-media-upgrade=keywords-in-chunks
*
*/
function sell_media_manual_upgrade_trigger() {
if ( ! class_exists( 'SellMedia' ) ) {
return;
}
if ( isset( $_GET['sell-media-upgrade'] ) && 'keywords-in-chunks' === $_GET['sell-media-upgrade'] ) {
// Schedule an event that fires every minute to repair attachments in chunks.
if ( ! wp_next_scheduled( 'sell_media_upgrade_events' ) ) {
wp_schedule_event( time(), 'minute', 'sell_media_upgrade_events' );
}
}
}
add_action( 'admin_init', 'sell_media_manual_upgrade_trigger' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment