[WordPress] 外掛分享: Remove jQuery from Theme

首頁外掛目錄 › Remove jQuery from Theme
200+
安裝啟用
★★★★★
5/5 分(1 則評價)
1836 天前
最後更新
問題解決
WordPress 5.0+ v1.0 上架:2021-03-08

內容簡介

當沒有管理員登入時,將 jQuery 從您的前端佈景主題中移除。當您在後台或管理員工具列顯示時,jQuery 仍會繼續運作。依賴 jQuery 的外掛也不會被載入。

這個外掛沒有超過以上述功能:

function init_without_jquery() {
if (!is_admin() AND !is_admin_bar_showing()) {
wp_deregister_script('jquery');
wp_register_script('jquery', false);
}
}

add_action('init', 'init_without_jquery');

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Remove jQuery from Theme」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Removes jQuery from your frontend theme if no administrator is logged-in. jQuery will continue to work in you backend and when the admin toolbar is visible. Plugins which depend on jQuery will not be loaded either.
This plugin does nothing more but this:
function init_without_jquery() {
if (!is_admin() AND !is_admin_bar_showing()) {
wp_deregister_script('jquery');
wp_register_script('jquery', false);
}
}

add_action('init', 'init_without_jquery');

延伸相關外掛

文章
Filter
Apply Filters
Mastodon