A circular pink flower, with yellow in the center

Singletons & Dependency Injection In WordPress

Singletons used to be very common in WordPress plugins. It used to be that singletons were the only way, besides global variables to have a globally available instance of a class in a WordPress plugin. This section covers why Singletons are not great and when it’s not a big deal. It will cover some ways to refactor plugins so they don’t have singletons.

This Content Is Members Only

  • Access To All eBooks
  • Request New Code Samples
  • Early Access To Content