initializing custom block plugin development featured image

How to Initialize WordPress Custom Block Plugin Development and Connect It to Github

2–3 minutes

Blocks are essential elements in WordPress website development. They make it easy for users to add components—such as text, images, videos, sections, and more—to any page. WordPress comes with built-in blocks comprising the basic components mentioned above; these are immediately available for use in the Gutenberg editor right after WordPress is installed. If the built-in blocks prove insufficient, the WordPress repository also offers free plugins that provide a wide range of additional block elements.

Issues arise when building a custom website where specific element requirements cannot be met by existing WordPress blocks—whether they are built-in or sourced from repository plugins. We want blocks that are perfectly tailored to the website we are building—nothing more, nothing less. This is precisely where the need to create a custom block plugin arises.

This article discusses the initial steps of developing a custom block plugin and linking it to GitHub. The scope is limited to the initiation phase, as a comprehensive guide to the entire development process would require a much more in-depth article; alternatively, you can consult the WordPress Block Editor Handbook directly. The steps outlined here are sourced from the WordPress Developer Blog, ensuring the information is reliable.

Before getting started, there are several tools that need to be installed on our devices: a local WordPress environment (we use Docker), Git, GitHub Desktop, Node.js, and a code editor (we use VS Code).

Here are the steps:

1. Plugin Setup

  1. Open your WordPress website’s plugins folder using a code editor. It does not matter whether the folder already contains plugins or not; the important thing is that you can run commands in that folder via the terminal.
  2. Open the terminal within the code editor. If you are using VS Code, you can go to Terminal -> New Terminal.
  3. Ensure the terminal is pointing to the plugins folder.
  4. Run the following command in the terminal:
Membuka Terminal di VS Code
Opening Terminal in VS Code

Replace nama-plugin with your desired plugin name. Upon successful completion, the plugin folder will be populated with various folders and files, such as src, build, and nama-plugin.php.

2. Git Initialization

After successfully setting up the plugin, we need to initialize Git to create the repository. In the terminal, navigate to the plugin directory by running the following command:

After navigating the terminal to the plugin directory, run the following command to initialize Git:

3. Choose Repository

The next step after successfully initializing Git is to open GitHub Desktop. Ensure that GitHub Desktop is connected to your GitHub account. Click on Current Repository -> Add -> Add Existing Repository, then select the nama-plugin folder you created.

Add Existing Repository Github Desktop
Add Existing Repository Github Desktop

4. Commit Git

Once the plugin repository appears in GitHub Desktop, the next step is to commit. Fill in the summary field, then click the “Commit to Main” button.

github desktop commit
Github Desktop Commit

Once the steps above have been completed, we are ready to develop the custom WordPress block plugin. Developing this plugin requires several programming languages, including PHP, CSS, JavaScript, and React. Happy developing!

Let's Build Your Dream Website

Scale up your company with a more stunning and professional website from VRDA.

Contact us now for an attractive offer and a free consultation.

Related Content

wordpress-browser-extension-featured-image
date-icon

WordPress Released WordPress Browser Extension

On August 13, WordPress officially released the WordPress Browser Extension for Safari and Chrome. This extension is expected to make it easier for developers and creators to access WordPress features.

Read Article
how-to-make-a-wordpress-website-the-complete-beginners-guide-featured-image
date-icon

How to Make a WordPress Website: The Complete Beginner’s Guide

Learn how to make a WordPress website from scratch. Follow this guide to set up hosting, install WordPress, customize your site, and launch it online.

Read Article
wordpress-7-0-signals-a-new-era-for-ai-powered-publishing-featured-image
date-icon

WordPress 7.0 Signals a New Era for AI-Powered Publishing

WordPress 7.0 “Armstrong” marks a major shift for the platform with native AI infrastructure, a redesigned admin dashboard, and expanded Full Site Editing. The release adds provider-agnostic AI tools, new developer APIs, block-level CSS control, and performance improvements, signaling WordPress’s move toward a more modern, AI-ready publishing ecosystem.

Read Article