Chapter 5. Extending WordPress with Plugins

IN THIS CHAPTER

  • Understanding WordPress hooks

  • Writing your own plugin

  • Extending the WordPress Admin

  • Creating events with actions

  • Modifying content with filters

  • Using multi-argument hooks

  • Working with Custom Post Types

  • Localizing plugins

  • Sanitizing Data with the Security API

The beauty of WordPress is its extensibility. Some of the WordPress lead developers have said that the most exciting WordPress features are the ones that don't ship with the software.

It is possible to make WordPress do just about anything you can think of with plugins. The framework for this extensibility is made up of a very simple hook system. With hooks, plugin developers can change existing content and hypertext markup language (HTML) before it is actually rendered by the browser, or they can fire off actions when a certain event occurs.

Hooks are places in the WordPress code where plugins have the capability to "hook" into the core and add some bit of functionality. Hooks are an extensive part of the WordPress plugin architecture and are essential to the concept of modifying WordPress behavior without modifying any core code.

This event-driven architecture gives plugin developers extreme flexibility. In fact, many core WordPress features are implemented through the hooks system, which means that plugins are not second-class functionality, but are on par with the WordPress core. The WordPress core developers have not been hesitant to add more and more hooks to WordPress. It's ...

Get WordPress® Bible, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.