WordPress:Hacking WordPress

来自站长百科
Xxf3325讨论 | 贡献2008年4月28日 (一) 15:26的版本 (新页面: In very early versions of WordPress, the only way to modify the behavior of WordPress was through a "hack", i.e. by modifying the core files of WordPress. However, since version 1.5, Word...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航、​ 搜索

In very early versions of WordPress, the only way to modify the behavior of WordPress was through a "hack", i.e. by modifying the core files of WordPress. However, since version 1.5, WordPress has offered both plugin and theme capabilities as mechanisms to modify nearly everything that WordPress does, from looks to functionality, so hacks are seldom necessary any more, and certainly not recommended.

Hacks are not officially supported by WordPress. Use at your own risk.

Using WordPress Hacks

Although hacks are not recommended, and since version 1.5 of WordPress, seldom necessary, for completeness, this article still documents the my-hacks.php file, which you can enable and use for "hacks". Basically, you can put PHP functions and variable definitions into this file (which goes into your root WordPress installation directory), and if you activate it, it will be loaded just before plugins when WordPress starts up.

To activate my-hacks.php:

  • In the Administration Panel, choose Options > Miscellaneous.
  • At the bottom of the page, click the check box for Use legacy my-hacks.php file support to put a check in it.
  • Click Update to save the changed option.