Mahamudul Hasan Rubel
HomeBlogCoursesAboutProjectsSkillsExperiencePhotosContact
Mahamudul Hasan Rubel

Senior Software Engineer crafting high-performance web applications and SaaS platforms.

Navigation

  • Home
  • Blog
  • Courses
  • About
  • Projects
  • Skills
  • Experience
  • Photos
  • Contact

Get in Touch

Available for senior/lead roles and consulting.

bd.mhrubel@gmail.comHire Me

© 2026 Mahamudul Hasan Rubel. All rights reserved.

Built with using Next.js 16 & Tailwind v4

Back to Blog
Lesson 1 of the Intermediate WordPress Plugins: REST API & React Admin course
WordPressJune 25, 20263 min read

Setting up the WordPress Development Environment

Master professional WordPress development by setting up your local environment, initializing the plugin structure, and verifying your first activation.

WordPressLocalWPPlugin DevelopmentSetupEnvironmentphpplugin-development

Welcome to the "Intermediate WordPress Plugins: REST API & React Admin" course. This series assumes you have a baseline understanding of PHP and the WordPress plugin lifecycle, but we are moving beyond simple function files into modern, scalable architecture.

In this lesson, we will establish the foundation for our project: the "Knowledge Base" plugin. We’ll focus on professionalizing your local setup using LocalWP and defining a robust directory structure that supports the build tools we'll introduce in upcoming lessons.

Setting Up Your Local Development Server

To build modern, performant plugins, you need an environment that mimics production while allowing for rapid iteration. While tools like Docker or VVV are popular, LocalWP offers the best balance of speed and ease of use for WordPress plugin development.

  1. Download and Install: Grab the latest version from the official site.
  2. Create a New Site: Use the "Preferred" environment settings (latest PHP and MySQL versions).
  3. Enable WP_DEBUG: This is non-negotiable. Navigate to your site's folder, open wp-config.php, and ensure the following constants are set:
    PHP
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    Logging errors to wp-content/debug.log is far more professional than cluttering your UI with notices. If you find yourself struggling with complex issues later, refer to our guide on Error Handling and Logging: Building Robust WordPress Plugins for best practices.

Initializing the Plugin Structure

A professional plugin isn't just a single file. As we advance through this course, we will integrate React components, REST API classes, and build scripts. A flat structure will quickly become a maintenance nightmare.

Navigate to your site's wp-content/plugins/ directory and create a new folder named knowledge-base. Inside, we’ll start with this structure:

TEXT
knowledge-base/
├── assets/           # Compiled JS/CSS
├── src/              # Source code (React/JS)
├── includes/         # PHP classes and logic
├── knowledge-base.php # Main plugin entry point
└── package.json      # Dependency management

The Plugin Entry Point

Create knowledge-base.php in the root of your folder. WordPress requires specific headers to recognize your code as a plugin.

PHP
<?php
#6A9955">/**
 * Plugin Name: Knowledge Base
 * Description: A professional knowledge base with REST API and React UI.
 * Version: 1.0.0
 * Author: Your Name
 * Text Domain: knowledge-base
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; #6A9955">// Exit if accessed directly
}

#6A9955">// Simple autoloader or inclusion logic goes here later

Verifying Plugin Activation

Once the file is created, navigate to your WordPress Admin dashboard. Go to Plugins > Installed Plugins. You should see "Knowledge Base" listed. Click Activate.

If the plugin activates without error, you have successfully initialized your environment. If you receive a "Plugin file does not exist" error, double-check that your directory name matches the folder containing the main plugin file exactly.

Hands-on Exercise

  1. Initialize the folder: Create the knowledge-base directory structure as outlined above.
  2. Add a log test: In your knowledge-base.php file, add error_log('Knowledge Base initialized'); inside a simple activation hook.
  3. Verify: Activate the plugin, then check wp-content/debug.log in your local site folder. You should see your message.

Common Pitfalls

  • Case Sensitivity: WordPress is case-sensitive regarding folder names on Linux servers. Always use lowercase and hyphens for directory names to avoid deployment issues later.
  • Permissions: If you are using a local environment on macOS or Linux, ensure your user has write access to the wp-content/plugins folder.
  • Ignoring wp-config: Developing without WP_DEBUG enabled is the single biggest mistake beginners make. It hides critical warnings that will eventually break your production site.

As we move forward, keep your directory clean. We will be leveraging Advanced MVC: Dependency Injection for WordPress Plugins later in the course to keep our includes/ folder from becoming a procedural mess.

Recap

In this lesson, we configured a stable LocalWP instance, created a clean directory structure, and verified our plugin's activation. This structure is the bedrock for the build tools we will implement next.

Up next: Introduction to @wordpress/scripts — we'll set up your package.json and start compiling JavaScript.

Next lesson Introduction to @wordpress/scripts
Back to Blog

Similar Posts

WordPressJune 25, 20262 min read

Plugin Deployment Strategy: Preparing Your WordPress Release

Master the art of plugin deployment. Learn how to sanitize your folder structure, build a professional readme.txt, and prepare your plugin for distribution.

Read more
WordPressJune 25, 20263 min read

REST API Integration: Exposing Data for External Consumption

Learn to extend the WordPress REST API by registering custom endpoints. We'll show you how to securely serve your Knowledge Base data as structured JSON.

Part of the course

Intermediate WordPress Plugins: REST API & React Admin

intermediate · Lesson 1 of 45

  1. 1

    Setting up the WordPress Development Environment

    3 min
  2. 2

    Introduction to @wordpress/scripts

    3 min
  3. 3

    Configuring ESLint and Prettier

    3 min
Read more
WordPressJune 25, 20263 min read

Implementing CRUD in the Admin UI: WordPress REST API & React

Master CRUD operations in your WordPress admin dashboard. Learn to trigger API requests from React forms and lists to build truly interactive plugins.

Read more
  • 4

    Localizing Data for JavaScript

    3 min
  • 5

    Anatomy of a REST API Endpoint

    3 min
  • 6

    Implementing REST API Permission Callbacks

    3 min
  • 7

    Handling GET Requests in REST API

    3 min
  • 8

    Validating and Sanitizing API Arguments

    4 min
  • 9

    Creating POST Endpoints for Data Submission

    3 min
  • 10

    Updating Existing API Resources

    3 min
  • 11

    Handling Asynchronous State in React

    3 min
  • 12

    Building the Knowledge Base Service Layer

    3 min
  • 13

    Scaffolding the React Admin Dashboard

    3 min
  • 14

    Working with @wordpress/components

    3 min
  • 15

    Creating a React Form for Submissions

    3 min
  • 16

    Implementing CRUD in the Admin UI

    3 min
  • 17

    Understanding WordPress Data Store Architecture

    Coming soon
  • 18

    Registering a Custom Data Store

    Coming soon
  • 19

    Writing Selectors for Data Access

    Coming soon
  • 20

    Defining Actions and Reducers

    Coming soon
  • 21

    Implementing Resolvers for Data Fetching

    Coming soon
  • 22

    Optimizing Performance with Selectors

    Coming soon
  • 23

    Handling Complex State Dependencies

    Coming soon
  • 24

    Implementing Nonce Verification

    Coming soon
  • 25

    Advanced Sanitization Techniques

    Coming soon
  • 26

    Input Validation and Error Handling

    Coming soon
  • 27

    Protecting Admin Screens

    Coming soon
  • 28

    Production Build Pipeline

    Coming soon
  • 29

    Debugging React in the WordPress Admin

    Coming soon
  • 30

    Building Search and Filter Functionality

    Coming soon
  • 31

    Internationalization in React

    Coming soon
  • 32

    Managing File Uploads via REST API

    Coming soon
  • 33

    Optimizing API Response Times

    Coming soon
  • 34

    Working with Date and Time in React

    Coming soon
  • 35

    Implementing Drag-and-Drop Sorting

    Coming soon
  • 36

    Creating Custom Hooks for API Logic

    Coming soon
  • 37

    Integrating with Gutenberg Blocks

    Coming soon
  • 38

    Handling Conflict Resolution

    Coming soon
  • 39

    Building a Modal Confirmation System

    Coming soon
  • 40

    Implementing Activity Logging

    Coming soon
  • 41

    Using Webpack Aliases

    Coming soon
  • 42

    Unit Testing API Endpoints

    Coming soon
  • 43

    Unit Testing React Components

    Coming soon
  • 44

    Handling Large Datasets with GraphQL

    Coming soon
  • 45

    Implementing Real-time Updates with Web

    Coming soon
  • View full course