博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
wordpress 下一页_防止WordPress加载“下一页”
阅读量:2513 次
发布时间:2019-05-11

本文共 1576 字,大约阅读时间需要 5 分钟。

wordpress 下一页

I've been working to make this blog more performant by lazy loading everything I can think of, placing CSS and JavaScript into the HTML, and using data URIs;  the common theme in these is reducing the number of requests on each page.  One request I noticed (and hadn't anticipated) coming from WordPress looked like this:

我一直在努力通过延迟加载我能想到的所有内容,将CSS和JavaScript放入HTML中以及使用数据URI来提高此博客的性能。 这些中的共同主题是减少每个页面上的请求数量。 我注意到(但没想到)来自WordPress的一个请求看起来像这样:

Wordpress was essentially preloading the second listing page of my blog, assuming that people would click a link to page 2.  When looking at my blog stats, that was very rarely the case (probably because I list 15 items on the homepage, which is a lot), so why bother sending the request at all?  This bit of WordPress magic will prevent that LINK element from being used:

假设人们会单击页面2的链接,则WordPress本质上是预加载了我博客的第二个列表页面。在查看我的博客统计信息时,这种情况很少见(可能是因为我在主页上列出了15个项目,很多),那么为什么还要打扰发送请求呢? WordPress魔术的这一点将阻止使用该LINK元素:

// ... in functions.php...// Prevent unwanted next and prev link downloadsif(function_exists('remove_action')) { 	remove_action('wp_head', 'start_post_rel_link', 10, 0);	remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); }

There are two function calls removed -- one to prevent the tag from being used on the homepage/listing pages, and the other used on single blog posts.  Of course removing this call isn't for everyone but since I'm trying to micro-optimize the site, I thought I'd cut it out.

删除了两个函数调用-一个用于防止在首页/列表页上使用该标记,另一个则在单个博客文章上使用。 当然,删除此呼叫并不适合每个人,但由于我正在尝试对网站进行微优化,因此我想将其删除。

翻译自:

wordpress 下一页

转载地址:http://dlpwd.baihongyu.com/

你可能感兴趣的文章
Canvas基础
查看>>
[Hive - LanguageManual] Alter Table/Partition/Column
查看>>
可持久化数组
查看>>
去除IDEA报黄色/灰色的重复代码的下划波浪线
查看>>
Linux发送qq、网易邮件服务配置
查看>>
几道面试题
查看>>
【转】使用 WebGL 进行 3D 开发,第 1 部分: WebGL 简介
查看>>
js用正则表达式控制价格输入
查看>>
chromium浏览器开发系列第三篇:chromium源码目录结构
查看>>
java开发操作系统内核:由实模式进入保护模式之32位寻址
查看>>
第五讲:单例模式
查看>>
Python编程语言的起源
查看>>
Azure ARMTemplate模板,VM扩展命令
查看>>
使用Masstransit开发基于消息传递的分布式应用
查看>>
[CF808A] Lucky Year(规律)
查看>>
关于推送遇到的一些问题
查看>>
寒假作业3 抓老鼠啊~亏了还是赚了?
查看>>
Orcal Job创建实例
查看>>
Django
查看>>
批量Excel数据导入Oracle数据库(引用 自 wuhuacong(伍华聪)的专栏)
查看>>