Wordpress插件是必不可少的吗?

时间:2013-12-31 作者:Tony Fire

我是WordPress的新手。我最近读了一篇关于黑客如何利用插件漏洞的文章。Google Pagespeed等各种来源也劝阻我不要使用插件,或者至少将其保持在最低限度。就我个人而言,我也尽量避免使用插件,因为我觉得自己可以更好地控制网站上发生的事情,下载一个插件几乎感觉“很棒,我必须学会如何使用另一个插件”。

我知道“插件推荐”是离题的,但我想要的实际上是解释为什么/如果一些插件在WordPress中是必不可少的。

以这些为例:

Security - 一些顶级插件与安全性有关。但WordPress网站是否普遍易受攻击?为什么我需要一个额外的插件来避免被利用?

Back Up - 我是博客世界的新手,但大多数主机不都提供备份服务吗?或者我需要WordPress的特殊插件吗?

AdSense Click-Fraud Monitoring - 应该阻止点击炸弹,以避免被谷歌驱逐。但我不明白,除非你下载一个插件,否则所有人都必须做一些虚假的点击才能关闭你的收入吗?

编辑:最好在谷歌支持中询问这个问题,如果是的话,请忽略它

6 个回复
最合适的回答,由SO网友:bosco 整理而成

##Plugin Necessity##

What the necessity of plugins really boils down to is the question, "Am I satisfied that WordPress\'s core functionality is all that I need?"

If all you want is a simple blog with some categories and a number of static pages you\'re set. But if you want to start integrating interactive maps, calenders with events, maybe a 3rd-party REST API, force users to use strong passwords, or even turn the site into a social network then you need plugins. Grant Palin\'s answer provides more insight into why one might desire plugins. Dan Gayle\'s answer points out that many themes provide all sorts of plugin functionality without explicitly using WordPress plugins.



#Core Security# The WordPress core itself is considerably secure, and the core developer community does a respectable job isolating and patching security vulnerabilities as soon as they are identified - one of the benefits of having hundreds of millions of users and an average of around 200 core contributors per release. And the risk that used to be present for the duration between the identification of a vulnerability and the release of its fix is quickly being eliminated with the addition of Automatic Core Updates.

Excerpt from a Pagely WordPress security infographic. Click to view it in its entirety.

WordPress security infographic from Pagely (Fair amount of solid info - click through to view it in its entirety)

Yes, WordPress has inherent security vulnerabilities. But so do Drupal, CakePHP, Ruby on Rails, Symfony, Zend, etc.... There is no platform or system that I would use without implementing additional security precautions in addition to those already provided by the platform. I think it simply a bad idea to rely on the CMS or framework alone for the front-line security of any website, especially any framework with notable adoption rates.



#Plugin Security#

Plugins are not definitively insecure. The problem is that plugins are not vetted to ensure that their authors followed good security practices. WordPress has set forth a number of standards that authors should follow, but many plugins are authored by novices or others who ignore the standards. But as with all code-bases in existence, the more code you add to a system, the greater the likelihood of introducing bugs and vulnerabilities. The more plugins you add to your installation, the greater the risk you tend to take. By the same means, know that WordPress themes present an equally malicious threat - particularly the slews of "free themes" available from obscure theme-sites, many of which attempt to directly exploit your site rather than innocently exposing security vulnerabilities through ignorance or accident. Only obtain themes and plugins from trusted sources and credible authors.

A rule of thumb is to not install plugins from widely unknown authors or plugins that are relatively new on the scene. If you can, take the time to establish the author\'s credibility. Ideally, learn the factors that go into a well-secured plugin (numbers-used-once [a.k.a. "nonce"s] for request and URL authentication, input sanitization, output escaping, prevention of direct access to plugin files, proper access of the database through WordPress methods and functions, the absence of errors and deprecation notices when debugging is enabled [refrain from enabling it in production environments], etc.) and vet every plugin you install yourself. There is no substitute for understanding what goes into secure plugin script, nor any better defense from crappy plugins.

If the thought of insecure plugins and themes frightens you or you are not familiar with or seeking to become familiar with PHP, you may find the services of WordPress.com to be more your cup of tea as they assume responsibility for vetting plugins and themes and only allow those determined to be secure to be installed on users\' sites. You may still use a custom domain with WordPress.com if desired.



#Back it Up#

Some hosts provide such services, others don\'t. Just as I don\'t trust the security of any platform to stand on it\'s own, I don\'t trust any host to take care of my backups. Rather, I prefer to have my backups pile up in my Dropbox and synced to different servers so that I can be confident that I always have direct access to my backups with copies on several different systems. If my host goes down or is bought out by a larger company or some other hosting misfortune, my sites are a few clicks away without even the risk of having to deal with my host\'s support.



#Final Notes#

You should read the codex entry on Hardening WordPress for more security advice. If you don\'t think that you should need many plugins or any obscure plugins in the future, it may well be wiser to have WordPress.com or an alternate managed WordPress hosting provider such as Pagely host your blog.

Regardless of the new "Automatic Core Updates" feature of WordPress, you should still strive to manually ensure that your installation and all of your plugins and themes are up to date. Some might think it excessive, but I like to enable debugging after an update and ensure that no plugins or themes have lost compatibility (a stream of errors and deprecation notices is a strong symptom of this). If they have, I disable them until their authors update them, or make the necessary changes myself to hold me over until they release an official update. Note that you should either take your website offline or run an offline development copy of your website before you enable debugging to troubleshoot anything.

I am not sure as to the prevalence of the Ad-sense click-bombing practice, but a WordPress plugin offering to mitigate the effects of such click-bombs is offering you an additional layer of security in addition to whatever precautions Google has in place. Websites not running WordPress face the same exact threat regarding click-bombing, and either must implement protection by other means or survive without it.


Additional Resources

A functionally-focused introduction to plugin authoring with a few security tips intermixed. In particular, pay attention to the Plugin Development Suggestions section near the bottom of the page.

A brief introduction to these concepts and why they matter.

A syntactically-focused standard for PHP code in WordPress with a few security tips intermixed.

I would absolutely love to tell you to never install a plugin that neglects in-line documentation, but in reality even good developers don\'t always do this. Nonetheless, hearty in-line documentation complete with PHPDoc tags is a good indication that the author has some idea of what they\'re doing.

The answers to this question provide a few additional points that aren\'t listed in other resources. Note that this question is locked and will not be updated to reflect new developments.

In a nutshell, "When do I need to secure my data and when do the core functions handle it for me?"

A small list of some of the most trusted and renown names in WordPress plugin development. Certainly not exhaustive by any means, but a good starting place for a few quick "sure-bets." Note that this question is locked and will not be updated to reflect new developments.

Authored based on this very question regarding the necessity of plugins, hopefully this question will yield a general process for selecting trustworthy theme/plugin authors.

A solid non-technical overview regarding the dangers of plugins.

An excellent brief technical overview of best-practices for secure plugin development. Note that the infographic from wptemplate.com linked in the article contains some additional good tips for WordPress security as a whole, but is compiled rather poorly and authored in broken English.

The articles on Tuts+ are typically accurate and of considerable quality.

An excellent technical overview of WordPress security vulnerabilities and precautions based on Perez\'s Chicago 2012 WordCamp presentation.

SO网友:Rarst

简单地说,WordPress做它开箱即用的事情,不需要插件。

然而不同的人对它应该做什么有不同的想法。其中一些想法是正确的。有些人完全疯了。

特别是您的示例:

WP(或者更准确地说是目前最稳定的版本)是安全的,许多安全插件侧重于审计(比如其他插件的代码)和主动监控(没有什么是真正绝对安全的)。

许多人(包括我)不信任第三方来处理备份。有许多可怕的故事讲述了信任有备份的主机会导致非常悲惨的结果,除非您能够亲自监视、访问和验证主机(据说)正在接受的备份,否则将其视为不存在会更安全。

SO网友:Grant Palin

WordPress本身就很实用。如果您的需求很简单,或者您知道如何添加自定义功能,那么通常不需要插件。然而,插件模型有一些优点,我将列举其中一些:

模块化、即插即用(主要)功能封装了专门的功能,避免重新发明轮子,从有经验的插件作者的工作中获益。关于第二点,如果您想添加某些功能,很可能已经以插件形式实现了。从已经完成的工作中受益并没有错。

最后一点,许多可用的插件都是开发人员工作时间和经验的结果。这样的插件往往构建良好、支持良好,并享有声誉。看看皮平·威廉姆森、斯科特·金斯利·克拉克和亚历克斯·金,仅举几个例子。他们不仅有技术技能,而且有信誉。这是某些第三方插件的巨大好处。

在备份的情况下,我不愿意将如此重要的事情交给web主机,特别是如果备份保存在同一台服务器或同一个网络中。第三方插件或DIY方法为您提供了更多的控制,并且通常将备份存储在与网站非常不同的位置。

如果一个人拥有自己处理安全安排的诀窍,那么安全插件就不是绝对必要的。一些这样的插件,例如Better WP Security, 简化文件权限的处理,.htaccess 指令等。其他,如WordFence 提供监控服务,同时Limit Login Attempts 为站点后端提供一些保护。

如果你担心插件的质量,那可能是碰运气的事。我认为,WordPress插件repo上的插件至少要经过WordPress幕后人员的一些审查,但质量或价值是相当可变的,这在很大程度上取决于你的需求和能力。如果一个插件得到了很好的审查,有积极的支持,并且来自一个著名的作者或团队,那么您很可能会得到很好的帮助。

SO网友:Dan Gayle

备份可以由主机负责,但它们通常只提供“要么全有,要么全无”的方法。如果使用插件,则可以执行每周文件备份和每日数据库备份,在进行任何维护之前运行它们,或者将备份文件存储到SFTP/S3帐户中。如果没有插件,就无法做到这一点。

性能

因为您关心的是性能(正如您的Pagespeed参考资料所证明的那样),我所知道的使用第三方CDN托管图像的唯一方法是使用插件(除非您真的在服务器上编写脚本,在这种情况下,您可能不会在这里问这个问题)。

长期维护

任何驻留在WP范围之外并修改/更改您的内容(如短代码)的功能都应该驻留在插件中,因为您几乎可以肯定有一天会更改您的主题,并且您不希望站点上出现大量损坏的内容。

用户输入是许多安全漏洞的来源,所以如果你接受任何类型的用户数据,我肯定会考虑使用一个信誉良好的插件来处理。与您可能想要添加的一些手写表格相比,这些表格更容易被其他人审查并接受测试。

然而,有时你需要的一切都在你的主题中。(尤其是如果您在CodeCanyon/Envato等网站上购买了它,因为它们似乎是非常“功能”驱动的。)

有时候,为你的主题制作一个mod确实比处理一个插件要容易得多,比如一部分“seo”插件。

SO网友:WpMania.Net

实际上这取决于你的要求。如果您想在不修改主题文件的情况下为站点添加更多功能,那么您肯定需要插件。

SO网友:Brad Dalton

如果你想添加一个电子商务系统或完全自定义一个子主题,它们是必不可少的,否则你需要为电子商务之类的东西完成大量的自定义编码。

另一个重要点是,使用包含大量主题选项的主题与提供大量主题特定插件的主题之间的区别。

通过安装插件来添加功能而不是使用包含大量内置选项的主题来定制WordPress显然更容易,因为这样你就需要使用代码过滤现有功能,而不是只安装插件来添加需要使用的功能。

当WordPress的新版本也在Beta版时,插件中的代码也会更新,如果插件没有更新,您可以轻松删除并安装新插件。

结束

相关推荐

private functions in plugins

我开发了两个插件,其中一个功能相同(相同的名称,相同的功能)。当试图激活两个插件时,Wordpress会抛出一个错误,因为它不允许我以相同的名称定义函数两次。有没有一种方法可以使这个函数只对插件私有,而不使用面向对象编程,也不简单地重命名函数?我不想使用OOP,因为我首先要学习它。此外,我不想重命名该函数,因为我可能也想在其他插件中使用它,而重命名感觉不太合适。