Skip to content

How to Make a WordPress Admin Options Page (Without Using the Settings API)

We’re going to cover creating a working WordPress options page, without using the Settings API.

I don’t like the WordPress Settings API. And every time we talk about writing about it, I start whining like the most annoying child you can imagine. I whine because the Settings API is the most official way to make admin options pages in WordPress, which is an important thing to do for both public and private plugins. But to put it kindly, I find the WordPress Settings API baffling and more than a little bit quirky.

But there are parts to making options pages that don’t really involve the Settings API. And in fact, you don’t ever need to use it at all. Today we’re going to describe how to create an admin options page, and how to save a site-wide option—but without using the Settings API.

One more thing before we get started. If you’re looking to learn WordPress development, we’ve written the best guide to it out there:

The Best Way to Learn WordPress Development

Get Up and Running Today!

Up and Running is our complete “learn WordPress development” course. Now in its updated and expanded Third Edition, it’s helped hundreds of happy buyers learn WordPress development the fast, smart, and thorough way.

Yay! 🎉 You made it to the end of the article!
David Hayes
Share:

11 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Sascha Grindau
January 11, 2018 12:54 am

I did it that way
first i check if post is not empty.

if (!empty($_POST))
{
if (! isset( $_POST[‘name_of_nonce_field’] ) || ! wp_verify_nonce( $_POST[‘name_of_nonce_field’], ‘name_of_my_action’ ) )
{
print ‘Sorry, your nonce did not verify.’;
exit;
}
}

….form….
echo wp_nonce_field( ‘name_of_my_action’, ‘name_of_nonce_field’ );
…/form….

Newton
December 7, 2017 10:17 am

Hey Jason!

ACF is great, but we have to be careful.

Using ACF you can…
– Increase by 173% to render page
– Increase by 14% your number of queries
– Increase by 26% memory usage

You really should consider the advantages and disadvantages of using ACF.

See ya!

Anders
September 28, 2017 6:58 am

Hi there!

You are executing check_admin_referer without knowing that the request was a POST. This if-logic will effectively prevent all users from ever reaching the option page.

Sorry if I have made a mistake and my point is incorrect.
Nice article on a different approach although!

Cloud
September 19, 2017 2:19 am

No offense! Settings API is not pretty even tedious, but your way is worse. The Options page creating with Settings API is pluginable, extensible and flexiable, imagine that you created a plugin and an options page for this plugin, then other users or developers want to add extra settings fields or sections to the options page, it’s impossible by your way unless modify your code directly, but with Settings API, we can add/remove/modify a settings sections or fields without modify original file/codes.

Mulli
August 16, 2017 7:18 am

I wish I saw this article before…

I am using the setting API hoping that it will keep my admin updated with WP versions
BUT, its complex, simply the wrong way to go.

Soon I will replace using this article to hold my hand…
BIG LIKE and thanks

Tumiso Marebane
September 28, 2016 5:00 am

Thank you for this tut man …very helpful

Shrinivas
January 17, 2016 6:29 am

It is a useful article. How to add the tabbed setting pages for settings panel built with wordpress settings API?

Sarmen B.
July 27, 2015 8:05 pm

thank you!. i’d rather sanitize teh data myself then having to comprehend the settings api. i have 8 yrs of php and for some reason i cant wrap my head around learning the settings api.

Josh Pollock
March 4, 2015 10:11 pm

I’m not a huge fan of doing settings pages “The WordPress Way” either. That said, skipping register_setting(), and any sanitization of POST data at all, is a security risk, and is not a step worth skipping.

Mick Levin
February 24, 2015 6:03 pm

Nice intro article.

With WP4 however, it’s time to switch to Customizer API, it’s way simplier and allows preview changes while making them.

David Hayes
March 10, 2015 2:53 pm
Reply to  Mick Levin

The customizer’s great for visual things. But it’s hardly a complete one-for-one replacement with other ways to give a plugin feedback about how it should behave.

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!