在类中设置WordPress用户代理WP_Http
像
\'WordPress/\' . $wp_version . \'; \' . get_bloginfo( \'url\' )
您可以将其设置为每个筛选器的(机密)固定值:
add_filter( \'http_headers_useragent\', \'wpse_59788_user_agent\' );
function wpse_59788_user_agent()
{
// to remove this filter immediately uncomment the following line
// remove_filter( current_filter(), __FUNCTION__ );
return \'alfgjlkgjlkgjsldkjhrkjh\';
}
要更改插件升级的用户代理,请尝试以下操作(未测试):
add_filter( \'upgrader_pre_install\', \'wpse_59788_register\' );
function wpse_59788_register( $dummy )
{
add_filter( \'http_headers_useragent\', \'wpse_59788_user_agent\' );
return $dummy;
}
并取消对第一个函数中的自失活行的注释。