My preferred way of dong WordPress Plugin Development is by using Docker. Specifically, I use the wordpress and mariadb Docker images.

An example docker-compose.yml is as follows:

version: '3.7'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - ./wordpress:/var/www/html
      - ./container-loading:/var/www/html/wp-content/plugins/container-loading

  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  # wordpress:
  db:

By mounting plugin directory here:

  - ./container-loading:/var/www/html/wp-content/plugins/container-loading

I can work with the plugin using Visual Studio code and the plugin is automatically accessible within the WordPress container.

To start WordPress with the configuration, I do:

docker-compose up -d

Similar Posts

Disclosure: We may get a small commission if you buy certain products linked in this article. However, our opinions are our own and we only promote the products and services that we trust.