Get started developing Wordpress plugins in 5 minutes

14 May 2024

If you want to start developing Wordpress plugins quick and easy, this guide is for you.

Setting up your environment

Let's start by setting up your development environment. I use Docker, because it's easy to setup and use. Create a docker-compose.yml-file with something similar to this:
# /wordpress-docker/docker-compose.yml
---
version: '3.3'
services:
  db:
    container_name: 'local-wordpress-db'
    image: 'mysql:5.7'
    volumes:
      - './data/mysql:/var/lib/mysql'
    ports:
      - 18766:3306
    environment:
      MYSQL_ROOT_PASSWORD: somewordpress
      MYSQL_DATABASE: wordpress_db
      MYSQL_USER: wordpress_user
      MYSQL_PASSWORD: wordpress_password
  wordpress:
    container_name: 'local-wordpress'
    depends_on:
      - db
    image: 'wordpress:latest'
    ports:
      - '80:80'
    environment:
      WORDPRESS_DB_HOST: 'db:3306'
      WORDPRESS_DB_USER: wordpress_user
      WORDPRESS_DB_PASSWORD: wordpress_password
      WORDPRESS_DB_NAME: wordpress_db
    volumes:
      - "./wordpress:/var/www/html"
      - "./plugins:/var/www/html/wp-content/plugins"
The docker script installs the latest Wordpress version with all it's dependencies and a MySQL 5.7 database. If you need a specific Wordpress version (e.g. if your client runs an older intallation) simply replace latest with whatever version you need.

When you have your script setup, navigate to your folder in a terminal and write the following command:
docker-compose up
This installs everything, if it isn't already, and starts hosting the Wordpress installation locally.

Start developing your plugin

With everything setup and ready to go, you can start developing your plugin. I really enjoyed this YouTube video (Simple WordPress Plugin Development - Start to Finish) for getting started developing Wordpress plugins, but if you don't have 2.5 hours for a complete walkthrough, I'll detail the most important bits here. wordpress builk action https://duckduckgo.com/?q=wordpress+plugin+development+bulk+action&t=newext&atb=v331-1&ia=web https://ithemelandco.com/blog/what-is-bulk-action-wordpress/

You might also enjoy

Linux and various terminal stuff

Linux and various terminal stuff

Published 2024-04-26 — Updated 2024-05-13

Linux

Notes

Various tips, tricks and how-to's I have gathered while running different distributions of Linux.

Read the post →
Commandline arguments in Python

Commandline arguments in Python

Published 2024-04-23 — Updated 2024-04-26

Python

Learn how to use command-line arguments in Python with sys.argv. Pass arguments to your scripts, process them, and make your programs more flexible.

Read the post →
How to easily web scrape any website with Python

How to easily web scrape any website with Python

Published 2024-05-03

Datahoarding

Notes

Python

Web development

Learn how to easily web scrape any website using Python. I go through the various techniques I use.

Read the post →