WP通过向存储库发送关于所有插件和主题的数据来检查更新。为了防止您自己的代码出现错误的更新消息,您需要有选择地将其从这些请求中删除。
Mark Jaquith的主题示例:
function cws_hidden_theme_12345( $r, $url ) {
if ( 0 !== strpos( $url, \'http://api.wordpress.org/themes/update-check\' ) )
return $r; // Not a theme update request. Bail immediately.
$themes = unserialize( $r[\'body\'][\'themes\'] );
unset( $themes[ get_option( \'template\' ) ] );
unset( $themes[ get_option( \'stylesheet\' ) ] );
$r[\'body\'][\'themes\'] = serialize( $themes );
return $r;
}
add_filter( \'http_request_args\', \'cws_hidden_theme_12345\', 5, 2 );
请参见
excluding your plugin or theme from update checks 有关详细信息的完整帖子。