Learn the essential WordPress plugin directory conventions and the mandatory file header required to build, activate, and manage your custom plugins.
Welcome to the first step of our journey. Before we dive into complex architecture or database operations, we must establish the ground rules for how WordPress identifies and manages your code.
In this course, we are building a professional-grade Knowledge Base plugin. To ensure your code remains maintainable as we scale, we will treat this plugin as a software project, not just a collection of scripts.
WordPress looks for plugins within the /wp-content/plugins/ directory. Each plugin must reside in its own dedicated folder. While a simple plugin can exist as a single file, a professional-grade WordPress plugin architecture requires a structured approach to keep logic separated.
To begin our Knowledge Base project, navigate to your local WordPress installation’s wp-content/plugins/ folder and create a new directory named wp-knowledge-base.
Inside this folder, we will create our main entry point: wp-knowledge-base.php.

WordPress does not automatically "know" that your folder contains a valid plugin. It scans the files in your directory looking for a specific, comment-based header. This header acts as the plugin's metadata manifest.
Open wp-knowledge-base.php and add the following block at the very top of the file:
PHP<?php #6A9955">/** * Plugin Name: Knowledge Base * Plugin URI: https:#6A9955">//example.com/knowledge-base * Description: A powerful knowledge base system for WordPress. * Version: 1.0.0 * Author: Your Name * Author URI: https:#6A9955">//example.com * License: GPL2 * Text Domain: wp-knowledge-base */ #6A9955">// Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; }
Once you have saved the file, head over to your WordPress Dashboard and navigate to the Plugins menu. You should now see "Knowledge Base" listed among your plugins.
Click Activate.
WordPress now tracks your plugin in the wp_options table under the active_plugins key. Once active, your code is included in the execution flow of every page request on your site.
wp-content/plugins/ directory.wp-knowledge-base folder and the wp-knowledge-base.php file.plugins/ folder without a sub-folder is generally discouraged. It makes your environment messy and makes it difficult to add assets (CSS/JS) or sub-classes later.Plugin Name is missing, WordPress will ignore the file entirely. Even if the file is syntactically valid PHP, it won't appear in the dashboard.test-plugin, you risk conflicts with other developers' code.
You have successfully laid the foundation for our project. We have created the folder, defined the mandatory file header, and triggered the activation state. You now have a working plugin entry point that adheres to the standards required for WordPress plugin activation.
In the next lesson, we will move beyond simple headers and learn how to use lifecycle hooks to perform tasks specifically when the plugin is activated or deactivated.
Up next: The Plugin Lifecycle Hooks
Learn to manage your plugin's lifecycle with activation and deactivation hooks. Discover how to safely initialize data and clean up resources in WordPress.
Read moreWordPress theme.json controls global styles and block editor configuration. Learn how the WP_Theme_JSON class processes data to build your site's design system.
Defining the Plugin Core Class
Understanding WordPress Hooks
Implementing Custom Action Hooks
Managing Hook Priorities
Creating Admin Menus
The Controller Layer for Admin Pages
Registering Custom Post Types
Configuring CPT Arguments
Introduction to Taxonomies
Designing Meta-Boxes
Sanitizing User Input
Saving Meta Data
Database Basics with wpdb
Secure CRUD Operations
Querying with WP_Query
Optimizing Queries
The Model Layer for Data
Enqueuing Scripts and Styles
Plugin Template Hierarchy
Creating Frontend Templates
Building Shortcodes
Advanced Shortcode Logic
Introduction to Gutenberg Blocks
The Settings API
Validating Settings
Implementing Nonces
Capability Checks
Handling Plugin Updates
Internationalization (i18n)
Debugging WordPress Plugins
Unit Testing Foundations
Handling AJAX Requests
REST API Integration
Advanced Database Queries
Caching Strategies
Plugin Security Best Practices
Composer for Dependencies
Theme Integration Hooks
Managing Assets with Gulp/Webpack
Documentation Standards
Plugin Deployment Strategy
Advanced MVC: Dependency Injection
Handling Large Datasets
Error Handling and Logging