Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindctrl/29924e033822e8a774afac29c4713cc7 to your computer and use it in GitHub Desktop.
Save mindctrl/29924e033822e8a774afac29c4713cc7 to your computer and use it in GitHub Desktop.
function simple_plugin_updater( $update_plugins, $transient_name ) {
$plugin = json_decode(
json_encode(
array(
'new_version' => 89,
'stable_version' => 89,
'name' => 'My Fake Plugin',
'slug' => 'my-fake-plugin.php',
'url' => 'https://myfakeplugin.com',
'last_updated' => '2019-01-24 18:42:57',
'homepage' => 'https://myfakeplugin.com',
'package' => 'https://myfakeplugin.com/my-fake-plugin.zip',
'download_link' => 'https://myfakeplugin.com',
'sections' => array(
'description' => wpautop( strip_tags( 'Description', '<p><li><ul><ol><strong><a><em>' ) ),
'changelog' => html_entity_decode( 'Changelog' )
),
'icons' => array(
'2x' => 'https://philjdrums.com/wp-content/uploads/2019/01/Phil-J-Drums-1.png',
'1x' => 'https://philjdrums.com/wp-content/uploads/2019/01/Phil-J-Drums-1.png',
'svg' => 'https://philjdrums.com/wp-content/uploads/2019/01/Phil-J-Drums-1.png'
),
'banners' => array(
'2x' => 'https://philjdrums.com/wp-content/uploads/2019/01/Phil-J-Drums-1.png',
'1x' => 'https://philjdrums.com/wp-content/uploads/2019/01/Phil-J-Drums-1.png'
),
'description' => array(),
'changelog' => array(),
'tested' => 5.0
)
), false, 3
);
$plugin->sections = (array)$plugin->sections;
$plugin->icons = (array)$plugin->icons;
$plugin->banners = (array)$plugin->banners;
$plugin->description = (array)$plugin->description;
$plugin->changelog = (array)$plugin->changelog;
$plugin->plugin = 'my-fake-plugin/my-fake-plugin.php';
$update_plugins->response['my-fake-plugin/my-fake-plugin.php'] = $plugin;
return $update_plugins;
}
add_filter( 'pre_set_site_transient_update_plugins', 'simple_plugin_updater', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment