WordPress Plugin Development
          WordCamp NL
           03/24/2012
Luc De Brouwer

Webdeveloper who loves WordPress, Magento,
PHP, MySQL, HTML, CSS, jQuery, good food and
Nine Inch Nails.
 •   lucdebrouwer.nl

 •   hello@lucdebrouwer.nl

 •   linkedin.com/in/lucdebrouwer

 •   twitter.com/ldebrouwer
Developing for WordPress is awesome!
The basics
Always start with the read me /
       documentation!
Pair with others
( Designers, developers, translators, ux specialists, etc. )
Turn debugging on
                     Your users will thank you for it.
Tip: Use Debug Bar and Debug Bar Console. It’s like Firebug for WordPress!
The nitty-gritty
   a.k.a. the fun stuff
Standard plugin information
Time to get hooked!
Set some actions
Possible hooks

Filter functions       Action functions
has_filter()            has_action()
add_filter()            add_action()
apply_filters()         do_action()
current_filter()        do_action_ref_array()
merge_filters()         did_action()
remove_filter()         remove_action()
remove_all_filters()    remove_all_actions()
And some more..
Hooks for installation, activation, deactivation etc.
Set up your functions
Magic!
Do not reinvent the wheel!
WordPress has an API for almost anything. Built-in will most likely run better than bolted-on.
Storing preferences
                You’ve got plenty of options!


         add_option( ‘WordCampNL’, ‘FTW’ );
             get_option( ‘WordCampNL’);
update_option( ‘WordCampNL’, ’#WCNL12 is awesome’ );
But of course you can use
custom tables tables too!
There’s an API for that!
Making HTTP requests, performing filesystem tasks, unzipping files, etc..
Namespace your stuff to avoid f*ck ups
Give your classes and functions a clear prefix
Security!
Validate input, check user rights. We don’t any CSRF, XSS attacks etc.
The Codex is your friend
      http://codex.wordpress.org/
Publish your plugin to the
WordPress plugin repository
  Free feedback and a bigger platform for your work!
Afterwards
Set up a support plan!
Will you give support? If so, when? Will you offer paid support?
Keep everything up-to-date
  Check if it works with every WordPress update etc.
Embrace forks and feedback
        Open source matters!
Consult the code
By reading the core I learned more in 2 hours then I could have learned in a 2 day course.
Thank you for your attention!
Questions?
Want to contact me or ask questions?

           • lucdebrouwer.nl


           • hello@lucdebrouwer.nl


           • linkedin.com/in/lucdebrouwer


           • twitter.com/ldebrouwer

WordPress plugin development