JWR’s Control Panel plugin

I decided to do everything “the WordPress way” for this rebuild.

That means no monolith code. Everything is kept separate. My plugins will only talk to each other through APIs and hooks. Plus options should be configurable.

My 1st reaction was “This will be simple.”
My 2nd reaction was “Damn, I need a lot of options pages.”
My 3rd reaction was “There are too many options pages!” Not only were there too many pages, some only had 1 or 2 options. I hated it!

So I created a system for creating a shared options page using ACF Pro.

Details for JWR’s Control Panel plugin

Plugin name: JWR’s Control Panel
Status: Functional but in active development
URL: https://github.com/jwrobbs/jwr-control-panel
License: DBAD

Problem solved

JWR’s Control Panel lets developers create a WordPress options page with its fields organized into tabs. It leverages ACF Pro and its Local JSON system to create an ACF data file programmatically.

You can create multiple tabs for a single feature. You can create tabs for multiple features. Or you can mix and match.

How it works

Initial set up

  1. You must have ACF Pro installed and active.
  2. The plugin will create an options page and a Local JSON data set for the page.

Adding tabs and fields

You, the developer, have to do 2 things:

  1. Include a function call to “JWR_Plugin_Options::update_local_json()” in a plugin activation hook. This will trigger a rebuild of the Local JSON file.
  2. Add your new fields starting with a new tab. (See Usage below for details.) That function must be assigned to the “update_jwr_control_panel” hook.


All of the functions you’ll need are public static functions in the class JWR_Plugin_Options. (I have to rename that.)

Adding tabs

Syntax: JWR_Plugin_Options::add_tab( string $group_name, string $group_id );

group_name is the visible tab name. group_id is used internally to help create a unique key.

Adding fields

Fields available (2024-02-29)

  • Repeater
  • Number
  • True/false
  • Color picker
  • Checkbox
  • Text
  • Select
  • URL

I’m not going to go through all the syntaxes. But they’re easy to find in the code. They’re all “add_TYPE_field”.

They all share 2 parameters: field_label and field_slug. Label is what the user will see in the options. Slug is what you use to retrieve the value.

Using fields

Once the data file is created, everything is 100% ACF. You use ACF’s functions like get_field and get_fields.

Known Issues


Not all field types are represented

There are a ton of ACF field types that I haven’t added yet.

Not all options are useable

Each field has a ton of options. You can’t set them all. I’m balancing ease and simplicity against completeness. I’m not sure how it will play out.


Better/more consistent naming

Control panel vs options page. It should be “Options Page” across the board. And that should be reflected in both the code and the output.

White label

The panel should have a way to set its name easily.

Josh on Github Josh on LinkedIn Josh on Twitter