- How to Begin Writing Your First WordPress plugin
- Structuring Your First WordPress Plugin
- Writing Your First WordPress Plugin Part 3
- Writing Your First WordPress Plugin Part 4
- Writing Your First WordPress Plugin Part 5
- Writing Your First WordPress Plugin Part 6
- Writing Your First WordPress Plugin Part 7 – Final
In part 6 of Writing Your First WordPress Plugin, I’m going to continue where we left off in part 5 and demonstrate how to create your plugin settings form. We will create a complete settings page that allows you to save your plugin options to the database easily from the Settings page that we added in part 5. Plugin settings pages like this are extremely important for high quality plugins because they give your user a much higher lever of control.
Adding the options form is not very difficult, but it can be a bit confusing if you do not understand what is going on. The first thing we need to do is write another short function that will create our plugin options. This allows us to store our options in the WordPress options table. This function should be placed inside of your “admin-page.php” file.
You must be logged in to view the rest of this content. Register or login from the sidebar.

I have 2 users, and for some reason the twitter information I enter for one user shows up for the other user and vice versa. It’s like they’re seeing the same array field. How come? Great tutorial btw!
Sounds like you have the field names mixed up somewhere. Confirm that all of your input names are correct, and also that the name of the option you are retrieving for each field is correct. Feel free to show me your code via a pastebin.com if you want.
Amazing! Amazing!! Amazing!!!
Ha, thanks
Nice tutorial.
But still i stucked, got some errors after submitting the url.
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘mfwp_register_settings ‘ was given in /home/ewdcom/public_html/webassignment.in/theme2/wp-includes/plugin.php on line 405
ERROR: options page not found.
Can you show your code please? That error is shown because WP is looking for a function named “mfwp_register_settings”, but it’s not found, so you have probably named it something else.
I am not usually one to comment on a tutorial page but I wanted to take a second and thank you for all of the work and the sudo-in-depth explanation of what is going behind the curtain. This has been very helpful to me and several others that I know are using it. So again thank you.
BTW …
Is there a real advantage to being a paid subscriber if so what is it ?
I’m glad you enjoyed it and thank you for your comment!
As a paid subscriber, you get access to all premium tutorials and several premium plugins. You can see the complete list here.
Hi Pippins Your tutorials are awesome.! Had a great time with lesson five.How does one expand the dropdown actions on Posts to include delete or custom actions. You also need to put together a book and expand from begginers to complex level by exapanding on real life scenairo problems. Thanks once again and am hoping to hear from you.
I’m glad you like them! By drop down actions, are you referring to the sub menu items under the main Posts menu?
WHOA! You are right. There is a lot of stuff going on with the admin options. My head is spinning a bit now, but I’ll take your recommendation for right now to just focus on learning how to add additional inputs, text areas, etc…and allow the register_settings and such come to me in time. I greatly appreciate you taking the time to put this tutorial together. It has been extremely helpful.
Simply great¡¡ Clear, quick and to the point¡¡
Thanks for your great tutorial! I have some plugin idea in my head- yiur tutorial is a great start!
Something in my setup isn’t allowing the data to save. I’ve gone over the code at least 10 times, fixing mistakes and typos, but now I don’t see anything wrong. I had already started my plugin when I got stuck, so some of the elements are in a different order than your tut, but they’re all there and I removed most of the extras I picked up from other tuts along the way.
The fields appear fine, then the message that the settings were saved appears as it should, but the fields empty upon save and refresh.
It’s evolving as I go, but here’s the code up on GitHub: https://github.com/pmgllc/stealth-login-page
Any insights into my error(s) would be greatly appreciated.
I found the error – finally. I was recording the input value as _settings instead of _options. Now the fields are entered when I reloaded the page – didn’t even have to re-enter them.
Great!
Hello again, I can update the URL and it displays. Problem is it also dispays the URL of the home website when I hover? E.g:
http://www.foxtracker.com.au/www.twitter.com
instead of
http://www.twitter.com
??
I don’t understand your question.
I have added the code and updated a twitter address in the field on the admin page. When I then go to the post and hover the mouse over the URL instead of http://www.twitter.com showing and being able to click on it, it shows my websiteurl + the twitter url. I have at no point typed in my homepage URl so it is like it is adding the home page url + what I type in.
If you go here:
http://foxtracker.com.au/?p=1
you will see what I mean.
Where at on that page?
I have redone the code and it works now. No idea why though….
sorry…spoke to soon.
Go to this URL (http://foxtracker.com.au/?p=15
) and hover over ‘Twitter’ and look at the url that pop’s up.
it is showing the home URL plus what I add in the admin page [twitter_url]
It’s acting like i have ‘plugin_dir_url( __file__ )’ as part of the $extra_content field.
Got it!
I was putting http://www.twitter.com in the field and getting the issue. What I did was put HTTP as well and that fixed it.
It would seem that if WordPress uses the HTTP to identify a URL as aposed to a page where the site URL in front of the page name is legit.
finally……
Great!