Pippins Plugins
  • Email
  • Facebook
  • Feedburner
  • Github
  • Google
  • Twitter
  • Vimeo
  • Youtube
  • Rss
  • About
  • News
  • Join the Site
    • Member Benefits
    • Member Plugins
    • Email Notifications
  • Plugin Store
    • Affiliate Area
    • Checkout
  • Plugins
    • Plugin Portfolio
      • Plugin Portfolio – List View
    • Free
    • Premium
    • Member Plugins
    • Coding Standards
    • Get Plugin Support
  • Tutorials
    • Series
      • Plugin Development 101
      • Creating a User Follow System Plugin
      • Customizing Restrict Content Pro
      • Displaying Content with Easy Content Types
      • Writing Your First WordPress Plugins, Basic to Advanced
      • Working with Widgets
      • User Submitted Image Galleries
      • Plugin Thoughts
      • Integrating Stripe.com with WordPress
      • WordPress Rewrite API
    • Member Exclusive
      • Free Members
      • Subscriber Only
    • Difficulty
      • Beginner
      • Intermediate
      • Advanced
    • Action and Filter Hooks
    • Ajax
    • Custom Post Types
    • External APIs
    • Short Codes
    • Taxonomies
    • Video Tutorials
    • Widget Tutorials
    • WordPress Admin / Dashboard
    • Working with jQuery
    • WordPress Database
    • Writing Plugins
    • Tag Index
  • Reviews
  • Support Forum
  • Contact
    • Support the Site
    • Request Code Review
    • Plugin Support

Writing Your First WordPress Plugin Part 6

Posted on November 11, 2011 by Pippin in Free Members, Intermediate, Member Restricted, Tutorials, WordPress Admin / Dashboard, Writing Plugins 24 Comments
Home» Member Restricted » Free Members » Writing Your First WordPress Plugin Part 6
Tweet
Love It - 2
This entry is part 6 of 7 in the Writing Your First WordPress Plugins, Basic to Advanced Series
← Writing Your First WordPress Plugin Part 5Writing Your First WordPress Plugin Part 7 – Final →
  • 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.

Tweet Follow @pippinsplugins
add_options_page, options, register_setting, twitter

24 comments on “Writing Your First WordPress Plugin Part 6”

  1. mellomee says:
    February 15, 2012 at 8:38 pm

    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!

    Reply
    • Pippin says:
      February 16, 2012 at 9:53 am

      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.

  2. sagarnangare says:
    April 1, 2012 at 4:29 am

    Amazing! Amazing!! Amazing!!!

    Reply
    • Pippin says:
      April 1, 2012 at 10:28 am

      Ha, thanks :)

  3. anibabbar says:
    June 29, 2012 at 1:06 am

    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.

    Reply
    • Pippin says:
      June 29, 2012 at 2:57 pm

      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.

  4. Axxanoid says:
    August 5, 2012 at 8:43 pm

    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 ?

    Reply
    • Pippin says:
      August 5, 2012 at 10:52 pm

      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.

  5. seyi says:
    September 10, 2012 at 11:42 am

    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.

    Reply
    • Pippin says:
      September 10, 2012 at 10:28 pm

      I’m glad you like them! By drop down actions, are you referring to the sub menu items under the main Posts menu?

  6. aeboi80 says:
    September 18, 2012 at 3:18 pm

    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.

    Reply
  7. mcartur says:
    November 9, 2012 at 6:14 am

    Simply great¡¡ Clear, quick and to the point¡¡

    Reply
  8. Ilya Libin says:
    February 13, 2013 at 2:31 pm

    Thanks for your great tutorial! I have some plugin idea in my head- yiur tutorial is a great start!

    Reply
  9. Jesse Petersen says:
    March 29, 2013 at 12:31 pm

    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.

    Reply
    • Jesse Petersen says:
      March 29, 2013 at 12:50 pm

      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.

    • Pippin says:
      March 30, 2013 at 1:16 pm

      Great!

  10. Peter McInerney says:
    March 30, 2013 at 6:34 am

    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

    ??

    Reply
    • Pippin says:
      April 1, 2013 at 1:49 pm

      I don’t understand your question.

  11. Peter McInerney says:
    April 2, 2013 at 2:14 am

    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.

    Reply
    • Pippin says:
      April 2, 2013 at 3:09 pm

      Where at on that page?

  12. Peter McInerney says:
    April 4, 2013 at 5:48 am

    I have redone the code and it works now. No idea why though….

    Reply
  13. Peter McInerney says:
    April 4, 2013 at 6:10 am

    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.

    Reply
  14. Peter McInerney says:
    April 5, 2013 at 1:55 am

    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……

    Reply
    • Pippin says:
      April 6, 2013 at 8:41 am

      Great!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Login

Lost your password?

Please enter your username or e-mail address. You will receive a new password via e-mail.

  • Facebook Become a Fan Like

  • Twitter Subscribe on Twitter Follow

  • YouTube Follow my Videos Subscribe

  • RSS Feed Subscribe with RSS Subscribe

Easy Digital Downloads

Most Loved

  • Love It Pro for WordPress
  • Write a “Love It” Plugin with Ajax to Let Users Love Their Favorite Posts / Pages
  • Simple Notices Pro Plugin for WordPress
  • User Bookmarks for WordPress
  • Front End Registration and Login Forms Plugin

Similar Plugins and Posts

  • How I Built the Settings System for Easy Digital Downloads
  • Using Ajax in Your Plugin and WordPress Admin
  • Drag and Drop Order for Plugin Options
  • Writing Your First WordPress Plugin Part 7 – Final
  • Writing Your First WordPress Plugin Part 5

Latest Premium Content

  • Plugin Development 101 – Introduction to Adding Dashboard Menus
  • Plugin Development 101 – Intro to Loading Scripts and Styles
  • User Follow System – Part 5
  • Plugin Development 101 – Intro to Short Codes
  • Plugin Development 101 – Registering a Custom Post Type
  • Plugin Development 101 – Intro to Actions

Latest Tutorials

  • Submitting Your First Pull Request to a WordPress Plugin on Github (1)

    Github is an extremely popular tool for managing WordPress plugins, and one...

  • Plugin Development 101 – Introduction to Adding Dashboard Menus (1)

    Adding new menus, both top level and sub level, to the WordPress Dashboard is a really common task for plugins...

  • Plugin Development 101 – Intro to Loading Scripts and Styles (16)

    In this part of Plugin...

Enter your email to receive automated updates when new posts are published

Latest Tweets

  • @jasonbobich hmm, interestinf
    May 19, 2013
  • @jasonbobich I haven&#039;t recently
    May 19, 2013
  • @strickland lol I passed out for two hours, so who knows
    May 19, 2013

Topics

get_user_meta the_content wp_enqueue_script add_options_page shortcodes contextual help attachments meta box register_setting add_shortcode featured Sugar Event Calendar hook login forms authors short codes attachment Related posts plugin do_action mail chimp image recent posts comments apply_filters post types bbpress short code taxonomies custom post type gallery Ajax images Stripe taxonomy jquery widgets users add_filter add_action easy content types widget restrict content pro easy digital downloads

Weekly Newsletter

Useful Links

  • Join the Site
  • Plugin Store
  • Affiliate Area
  • Tag Index
  • Support the Site
  • Suggest a Tutorial
  • Random Post
  • Contact

Monthly Archives

(c) 2011 Pippin's Plugins