我正在尝试阻止脚本在我的 WordPress 网站上以 HTML 形式加载。 在我的 HTML 文件中,我可以看到这两个脚本:
<script type="0f1a6d7ca503db410c0d10c4-text/javascript" src='https://www.[-----------].se/wp-content/plugins/theme-my-login/资产/脚本/theme-my-login.min.js?ver=7.1.2' id='theme-my-login-js'></script>
<script type="0f1a6d7ca503db410c0d10c4-text/javascript" src='https://www.phpcnc.com [------------].se/wp-content/themes/guru/framework/js/public/jquery.smartresize.js?ver=5.5.2' id='jquery-smartresize-js '></script>
在 public_html/wp-content/themes/guru/framework/register_public.php
中,我可以注释掉第二个脚本,并通过在上面的 php 中设置 /* */ 来防止其加载到 HTML文件:
/* wp_enqueue_script('jquery-smartresize', $template_uri.'/js/public/jquery.smartresize.js', array(), false, true); */
第一个脚本来自我想在某个页面上使用的插件,所以我不想停用该插件。我将在 php 文件中构建一个 IF 语句,以根据页面 URL 排除/包含插件脚本加载到 HTML 中。
我的问题是我找不到将第一个脚本加载到 HTML 的 php 文件,就像我为第二个脚本找到的那样。在 public_html 中通过 ssh 搜索时,我没有发现任何有趣的内容或获得很多点击。我可以添加过滤器广告吗?过滤器的代码是怎样的?我想最好阻止 wp_enqueue_script 执行,而不是让 wp_enqueue_script 然后添加过滤器。
其实我只用过
我没有调用函数 SO_21097900...这不起作用...我不知道该函数该放在哪里。如果我将该函数放在同一个 php 文件中,那么我的网站就会崩溃。
是的,您可以在不需要的地方将脚本出列