如何清理 WordPress 代码?
我正在寻找一些技巧来清理 WordPress 和一些插件生成的代码,因为我对 WordPress 生成的代码不满意,原因有两个:
代码格式不正确。我知道,我知道......这并不重要,因为浏览器不需要“解析”格式良好的代码。但是,我喜欢保持所有代码的格式良好,其中包括我或第三方系统生成的 HTML 代码。
不幸的是,WordPress 放在
上的代码的某些部分格式不正确,并且在某些情况下这些部分并不是真正必要的。顺便说一句,我不知道如何清理它或如何挂钩打印该代码的函数。
有没有办法在不更改核心文件/代码的情况下向 WordPress 生成的代码添加制表符/空格?
谢谢你!
I'm looking for some tips to clean the code which is generated by WordPress and some plug-ins, because I'm not happy with the code generated by WordPress for two reasons:
The code isn't well formatted. I know, I know... It isn't important since that the browsers don't need to "parse" a well formatted code. However, I like to keep all codes well formatted and it includes HTML code generated by me or third-part systems.
Unfortunately, some parts of the code that WordPress puts on the
<head>
aren't well formatted and in some cases those parts aren't really necessary. By the way, I have no idea about how to clean-up it or how to hook the function which prints that code.
Is there some way to add tabs / spaces to the code generated by WordPress without change the core files / code?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
忽略您的问题的整体模糊性,您需要编辑以修复
元素的文件是 header.php。您将在 wp-contents 的主题文件夹中找到它。
Overlooking the overall ambiguity of your question, the file you need to edit to fix the
<head>
element is header.php. You will find it in your theme's folder in wp-contents.