Ollie Block Academy

Creating a Block Plugin From Scratch

Adding the main plugin file

Every WordPress plugin needs a main PHP file with plugin headers to be recognized by WordPress. Include the plugin name and disable automatic updates to prevent conflicts.

Define a constant referencing the plugin root directory using __DIR__ magic constant. This path reference becomes essential for registering blocks and enqueuing assets correctly.

Modern PHP allows using const syntax instead of define() for cleaner constant definitions. This constant enables relative path references throughout your plugin architecture.

Back to: Ollie Block Academy > Creating a Block Plugin From Scratch