Some time ago I built a plugin with settings. I used the WordPress settings API. It was daunting, and repetitive. I built more plugins, which also had settings. As any developer, I was tired of doing repetitive tasks, and decided to write a wrapper for the WordPress settings API.
View the complete sample plugin on GitHub using Quilt & Lumber: A WordPress Settings API wrapper.
But, first a search…GitHub, and Google
A quick GitHub search for “WordPress settings” turned up a no longer supported WordPress settings API frame work. While a Google search resulted in a in a popular blog post, which I’ll summarize with a quote:
Meanwhile every popular WordPress plugin uses some form of custom settings wrapper. Be it Easy Digital Downloads (EDD), where all settings are assigned via an array, and then linked to a custom function form field callback.
Wrappers may not be the best way, but they are a reality.
Learn the WordPress Settings API
However I strongly stress to learn how to build settings using the WordPress settings API. I did. As any season WordPress developer should. Later I gleaned from past experiences, EDD, WooCommerce, and others.
As seen in the WordPress codex, this is just too much.
Quilt & Lumber
Over the course of the year Quilt & Lumber was born. Quilt allowed me to quickly build out settings as a tabbed interface or a single page. While being able to hook into the core code. Along with providing sanitization for all fields.
Lumber is the back bone to creating forms. Be it form fields for Quilt, WordPress post meta, or front-end HTML forms. Lumber was able to handle it.
Quilt’s forte is neatly wrapping those pesky WordPress settings API functions, and handling sanitization.
Together they; increased my work flow, helped maintain my sanity when looking at the WordPress settings API, and provided a single point to; add additional form fields, sanitize methods, and track down bugs.
A note on Themes
No to Theme Options, yes to Theme Customizer.