When you activate a plugin, the name of the file containing the information header is stored in the WordPress database. Each time a page is requested, WordPress goes through a laundry list of PHP files it needs to load, so activating a plugin ensures that your own files are on that list. To help illustrate this concept, let's break WordPress again.
Try the following exercise:
Ensure that the "Hello Dolly" plugin is active.
Open the
/wp-content/plugins/hello.php
file in your text editor.Immediately before the line that contains function hello_dolly_get_lyric, type in some gibberish text, such as "asdfasdf" and save the file.
Reload the plugins page in your browser.
This should generate a parse error, something like:
Parse error: syntax error, unexpected T_FUNCTION in /path/to/wordpress/html/wp-content/plugins/hello.php on line 16
Yikes! Your site is now broken. Why did this happen? We introduced errors into the plugin's main file (hello.php
), so...