本文档介绍了 WordPress 插件 API 中的钩子(Hooks),包括动作(Actions)和过滤器(Filters),并重点说明了主题中需要手动包含的特定钩子,以确保与插件的兼容性。
A theme should work well with WordPress plugins. Plugins add functionality by using actions and filters, which are collectively called hooks (see Plugin API for more information).
Most hooks are executed internally by WordPress, so your theme does not need special tags for them to work. However, a few hooks need to be included in your theme templates. These hooks are fired by special Template Tags:
Take a look at a core theme’s templates for examples of how these hooks are used.