Book Image

WordPress Development Quick Start Guide

By : Rakhitha Nimesh Ratnayake
Book Image

WordPress Development Quick Start Guide

By: Rakhitha Nimesh Ratnayake

Overview of this book

WordPress is the most used CMS in the world and is the ideal way to share your knowledge with a large audience or build a profitable business. Getting started with WordPress development has often been a challenge for novice developers, and this book will help you find your way. This book explains the components used in WordPress development, when and where to use them, and why you should be using each component in specific scenarios. You begin by learning the basic development setup and coding standards of WordPress. Then you move into the most important aspects of the theme and plugin development process. Here you will also learn how themes and plugins fit into the website while learning about a range of techniques for extending themes and plugins. With the basics covered, we explore many of the APIs provided by WordPress and how we can leverage them to build rapid solutions. Next, we move on to look at the techniques for capturing, processing, and displaying user data when integrating third-party components into the site design. Finally, you will learn how to test and deploy your work with secure and maintainable code, while providing the best performance for end users.
Table of Contents (16 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Exploring the life cycle of a plugin


A product life cycle is a series of events or stages that occur from the start to the completion of the product or process. WordPress plugins contain life cycle events, from initial activation to uninstallation. It's important to understand all of these events to keep the plugin working and make the data consistent, even after exiting the plugin. Many developers are aware of only a few of these events, leading to low quality plugins.

In this section, we are going to look at the life cycle of a plugin and how we can manage each of the events in the cycle. Consider the following diagram for a basic illustration of events in a plugin:

As you can see, the life cycle of a plugin has five events, apart from its functionality. A plugin starts the cycle via an activation event. The cycle is completed with either deactivate or uninstall events, until it starts the cycle again with activation. Let's understand these five events:

  • Activation: This is a built-in event...