Where to Store WordPress Settings?

Where to Store WordPress Settings?

Matt Watson's photo
Matt Watson
·Jun 15, 2020·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Saving some data in WordPress, but not entirely sure where it should go?

It is always good to have consistency when creating plugins, so I’ve made a handy little guide.

Block Settings DiagramBlock Settings Diagram

Network Setting (Multisite wide settings)

For settings that impact several of your sites (and provided they are in a Multisite network), you can create a network settings page.

Site Settings

If you only have a single site, or the settings only impact a single site of a Multisite instance, you can a settings page.

Site Appearance

If the changes impact the appearance of your entire site (not just a specific page), you should add a panel to the Customizer.

Post Settings

If your settings are on a per-post level, you should create a custom sidebar in the block editor (Gutenberg), or add a panel to the ‘Document’ sidebar.

You could also create a classic meta box.

Block Settings or Appearance

For individual block settings, or appearance you can use block Edit controls for block content, or use Block Controls (toolbar) and Inspector Controls for block specific layout and appearance.

 
Share this

Impressum

© Wholesome Code Ltd. (Business No: 12196107) All rights reserved.