Created
November 3, 2016 02:32
-
-
Save thadallender/7a6d7308ecae1aba9bf2f37090e01762 to your computer and use it in GitHub Desktop.
Sell Media Keyword Migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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: [email protected] | |
* 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