My theme uses the bundled jQuery of Wordpress and I want to load it asynchronously. (Yeah, PageSpeed Insights...)
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率

已采纳
如何在wordpress中异步排队jQuery?
收起
- 写回答
- 好问题 0 提建议
- 关注问题
微信扫一扫
点击复制链接分享
- 邀请回答
- 编辑 收藏 删除 结题
- 收藏 举报
2条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
doufeng1249 2018-05-11 01:35关注There is a hook for this script_loader_tag. You can use it as below
add_filter( 'script_loader_tag', 'add_asyn_to_script', 10, 3 ); function add_asyn_to_script( $tag, $handle, $src ) { //you can use this to make all async $tag = str_replace( ' src', ' async src', $tag ); // You can use this to make it work as below for a specific script if ( 'dropbox.js' === $handle ) $tag = '<script async type="text/javascript" src="' . esc_url( $src ) . '"></script>'; } return $tag; }
本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏举报微信扫一扫
点击复制链接分享
编辑预览轻敲空格完成输入- 显示为
- 卡片
- 标题
- 链接
评论按下Enter换行,Ctrl+Enter发表内容
编辑
预览

轻敲空格完成输入
- 显示为
- 卡片
- 标题
- 链接
报告相同问题?
提交
- 2014-02-20 07:09回答 1 已采纳 You need to de-register the existing query and re-register it to load in the footer. function jqu
- 2019-05-02 02:26回答 1 已采纳 I have tried to simplify the code. Meta fields are being created dynamically based on index. Pleas
- 2017-07-17 05:15回答 1 已采纳 Basically, what the snippet is doing is changing the already registered and enqueued jquery with t
- 2020-08-23 01:26culh2177的博客 这意味着,您可以从数据库中获取数据并将其显示在前端,而无需刷新页面。 It’s a fast and smooth way for displaying content, and as a result Ajax is now used in many various ways on a website, such as ...
- 2016-07-01 21:53回答 2 已采纳 This is what I ultimately did: <span class="post-info-text"><?php echo 'This interview w
- 2019-04-27 06:27回答 1 已采纳 To answer your question, yes, there is a function in Wordpress to disable script. Kindly see the l
- 2016-05-14 00:53回答 2 已采纳 thanks for comment but problem is pre-defined keyword "hour","minute" that's why ajax not called b
- 2020-09-12 19:40cumyupx7788305的博客 Do you want to eliminate render-blocking JavaScript and ... 您是否要消除WordPress中的阻止渲染JavaScript和CSS? If you test your website on Google PageSpeed insights, then you will likely see a sugg...
- 2015-05-26 08:19回答 1 已采纳 From: Uncaught TypeError: $(...).validationEngine is not a function It seems that the import
- 2013-01-20 10:03回答 2 已采纳 // only for Themes since WordPress 3.0 function jquery_190() { if ( !is_admin() ) { // actuall
- 2017-03-28 05:19回答 2 已采纳 After posting on the Stack Exchange site for WordPress, I found a solution. Basically, I had to en
- 2020-09-02 16:04culi4814的博客 首先,由于WordPress核心本身已将其用于媒体库中的异步上传,因此我们可以确保代码符合标准。 另外,所有验证和特权检查都已经完成,因此我们不需要自己做。 要求 (Requirements) There are several rules that ...
- 2019-02-11 03:34weixin_33825683的博客 吐槽一下,掘金好像并不能插入gist的代码框 效果有点打折扣 博客原文地址里有gist代码: ...在这篇文章里,我将向你介绍如何使用Vue.js在WordPress中创建单页面应用SPA(single page application):用WordPress做后...
- 2022-07-25 14:53Autumn_Hibiscus的博客 Ajax不是某种编程语言,是一种在无需重新加载整个网页的情况下能够更新部分网页的技术。改变了Web开发的格局。传统网页(即不使用Ajax技术的网页),想要更新内容或者提交一个表单,就需要重新载入页面。使用了Ajax...
- 2020-06-09 04:04cunjie3951的博客 几年前,我写了一系列文章,讨论如何在WordPress Frontend中使用Ajax 。 该系列的目的很简单: 我们将简要介绍一下Ajax是什么,它如何工作,如何在前端进行设置以及了解WordPress提供的功能。 实际上,我们还将...
- 没有解决我的问题, 去提问
联系我们(工作时间:8:30-22:00)
400-660-0108kefu@csdn.net在线客服
- 京ICP备19004658号
- 经营性网站备案信息
公安备案号11010502030143
- 营业执照
- 北京互联网违法和不良信息举报中心
- 家长监护
- 中国互联网举报中心
- 网络110报警服务
- Chrome商店下载
- 账号管理规范
- 版权与免责声明
- 版权申诉
- 出版物许可证
- ©1999-2025北京创新乐知网络技术有限公司