Intro
To understand how WordPress works, you need to know how the data that powers a WordPress site is stored and how it’s used. Data is stored in different categories, with the main four of them being split down further into two. The four main categories of data are:
Posts
Comments
Users
Terms
wp-content contains all user-supplied content. Basically anything you can upload to your site ends up here. That doesn’t include anything you write, mind you. Those things are stored in the WordPress database.
However, as long as you have both the database and your wp-content folder, you can always get your site back, even if everything else was lost.
The content of wp-content can sometimes be the cause of common WordPress errors. Specifically those caused by plugins and themes. When that happens and your site becomes inaccessible, you might have to access the plugin folder to deactivate some of them manually and get back into WordPress backend.
Despite its vital function, the name of wp-content is not set in stone. It’s entirely possible to change it to something else. Because WordPress is open source, anyone can figure out the basic structure of any site. The standard setup of WordPress is common knowledge, which makes it easier to start an attack. For that reason, renaming wp-content is one step towards a safer site.
Hooks are provided by WordPress to allow your plugin to 'hook into' the rest of WordPress; that is, to call functions in your plugin at specific times, and thereby set your plugin in motion. There are two kinds of hooks:
Actions
Filters
Actions
Actions are triggered by specific events that take place in WordPress, such as publishing a post, changing themes, or displaying an administration screen. An Action is a custom PHP function defined in your plugin (or theme) and hooked, i.e. set to respond, to some of these events. Actions usually do one or more of the following:
Modify database data.
Send an email message.
Modify the generated administration screen or front-end page sent to a user browser.
The basic steps to make this happen (described in more detail below) are:
Create a PHP function that should execute when a specific WordPress event occurs, in your plugin file.
Hook this function to the event by using the add_action() function.
Put your PHP function in a plugin file, and activate it.
Filters are functions that WordPress passes data through, at certain points in execution, just before taking some action with the data (such as adding it to the database or sending it to the browser screen). Filters sit between the database and the browser (when WordPress is generating pages), and between the browser and the database (when WordPress is adding new posts and comments to the database); most input and output in WordPress passes through at least one filter. WordPress does some filtering by default, and your plugin can add its own filtering.
The basic steps to add your own filters to WordPress (described in more detail below) are:
Create the PHP function that filters the data.
Hook to the filter in WordPress, by calling add_filter().
Put your PHP function in a plugin file, and activate it.