黃聰:wordpress后台加載ajax.googleapis.com導致打開速度很慢的解決方案


打開wordpress后台,發現很卡,通過開發者工具看到是因為加載http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css這個元素導致的。

<link rel='stylesheet' id='jquery-ui-smoothness-css'  href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css' type='text/css' media='all' />

 

解決方案:

functions.php里面添加如下代碼:

function hc_cdn_callback($buffer) {
    return str_replace('googleapis.com', 'useso.com', $buffer);
}
function hc_buffer_start() {
    ob_start("hc_cdn_callback");
}
function izt_buffer_end() {
    ob_end_flush();
}
add_action('init', 'hc_buffer_start');
add_action('shutdown', 'hc_buffer_end');

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM