这是可能的!
下面的示例代码是针对特定插件的(让我们将其命名为我的插件),但您可以对站点上的所有插件执行完全相同的操作。您只需修改$数据->;响应为“已完成”;我的插件/我的插件。php“;下面的插件
add_filter( \'pre_set_site_transient_update_plugins\', \'my_plugin_update_feed\' );
function my_plugin_update_feed( $data ) {
if ( empty( $data ) ) {
return $data;
}
$url = \'https://drive.google.com/path/to/my-plugin/release.json?\' . time();
$request = wp_remote_get( $url );
if ( is_wp_error( $request ) ) {
return $data;
}
$response = wp_remote_retrieve_body( $request );
$response = json_decode( $response );
if ( ! isset( $response->slug ) || ! isset( $response->new_version ) || ! isset( $response->url ) || ! isset( $response->package ) ) {
return $data;
}
if ( version_compare( MY_PLUGIN_VERSION, $response->new_version, \'<\' ) ) {
$data->response[ \'my-plugin/my-plugin.php\' ] = $response;
}
return $data;
}
然后释放。json应该是这样的:
{
"slug": "my-plugin",
"new_version": "0.0.3",
"url": "https://drive.google.com/path/to/my-plugin/",
"package": "https://drive.google.com/path/to/my-plugin/my-plugin-0.0.3.zip"
}
<小时/>