WordPress.org

Ready to get started?Download WordPress

WordPress 1.5 Developers' Primer

Posted February 28, 2005 by Laughinglizard. Filed under Documentation.

WordPress 1.5 is not just cool and suave on the outside, there are quite a few programming enhancements and added features for coders, hackers, plugin developers and enthusiasts. Some of these are obvious while others are more difficult to track down without digging through the code. This is a highly technical post, so feel free to skip it if that’s not your bag.

  • Transparent serializing and deserializing of objects and arrays when using add, update, and get_option.
    So for example, consider the following code:

    $this = array(array(), blah, blah, blah);
    update_option('xfnbl_data', $this);
    $newthis = get_option('xfnbl_data');

    The update_option function will transparently serialize the data. If you save an option as an array, the option is returned as an array.
  • If you update_option an option that doesn’t exist, it’ll create it: If the option did not exist when it was updated, it is created transparently. If the option did not exist when it was requested using get_option, the code degrades gracefully and does not error out, returning an empty variable.
  • Lots of hooks, including these tasty ones
    • You can dynamically modify any option returned without changing the option in the DB: There are two new hooks to help with this.

      add_filter('pre_option_' . $option_name, 'function_name');
      add_filter('all_options', 'function_name');
    • You can create and modify any XML-RPC call through the xmlrpc.php interface: Another cool new tool. If you need to add functions to the xmlrpc class (IXR) and then handle them as you like, just do something like the following:

      add_filter('xmlrpc_methods', 'Add_XBN_Stuff');
      function Add_XBN_stuff($args) {
      $args['demo.somefunction'] = 'somefunction';
      return $args;
      }
      function somefunction($stuff) {
      do_stuff($stuff)
      }

      For a better look at a plugin developed with this functionality, look at this plugin.
  • You can create pages in the admin interface: There are a bunch of functions that allow manipulation of the managment menus and create new pages.

    add_menu_page('Page Title', 'Menu Title', $access_level, 'PHP_File_to_Display')
    add_submenu_page('Parent_Page', 'Page Title', 'Menu Title', $access_level, 'PHP_File_to_Display', 'function_name')
    add_options_page('Page Title', 'Menu Title', $access_level, 'PHP_File_to_Display','function_name')
    add_management_page('Page Title', 'Menu Title', $access_level, 'PHP_File_to_Display','function_name')

    For an example see cache-images: http://svn.wp-plugins.org/cache-images/trunk/:
  • There’s a new hook for caching plugins that is called before everything is loaded, though you do have to edit wp-config.php to activate it.
  • A whole bunch of hooks to help plugin developers get more creative: Some of these are new, some have existed through 1.2. There are too many hooks to list here. Just do a search within the wordpress folder for the data item you are dealing with and ‘apply_filter’ or ‘do_action’. You are sure to find something that works for you.

No Pings

RSS feed for comments on this post.

  1. [...] dly [currently is optomized for 1024x550 Well, After recieving the automated email from WordPress, I download the new version and have a play with it. I’ve n [...]

    Pingback from Pie Eaters Anonymous » Welcome on March 2, 2005

  2. [...] WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress 1.5 D [...]

    Pingback from twl weblog » Blog Archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 4, 2005

  3. [...] WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress 1.5 D [...]

    Pingback from twl weblog » Blog Archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 4, 2005

  4. [...] WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress 1.5 D [...]

    Pingback from twl weblog » Blog Archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 4, 2005

  5. [...] WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress 1.5 D [...]

    Pingback from twl weblog » Blog Archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 4, 2005

  6. [...] WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress › Development Blog › WordPress 1.5 Developers’ Primer WordPress 1.5 D [...]

    Pingback from twl weblog » Blog Archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 4, 2005

  7. [...] rimoire
    queen
    gallery
    magpied bookmarks
    empress

    WordPress › Development Blog › WordPress 1.5 Developers’ Prim [...]

    Pingback from bookmarks » archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 7, 2005

  8. [...] rimoire
    queen
    gallery
    magpied bookmarks
    empress

    WordPress › Development Blog › WordPress 1.5 Developers’ Prim [...]

    Pingback from bookmarks » archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 7, 2005

  9. [...] rimoire
    queen
    gallery
    magpied bookmarks
    empress

    WordPress › Development Blog › WordPress 1.5 Developers’ Prim [...]

    Pingback from bookmarks » archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 7, 2005

  10. [...] rimoire
    queen
    gallery
    magpied bookmarks
    empress

    WordPress › Development Blog › WordPress 1.5 Developers’ Prim [...]

    Pingback from bookmarks » archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 7, 2005

  11. [...] rimoire
    queen
    gallery
    magpied bookmarks
    empress

    WordPress › Development Blog › WordPress 1.5 Developers’ Prim [...]

    Pingback from bookmarks » archive » WordPress › Development Blog › WordPress 1.5 Developers’ Primer on March 7, 2005

  12. [...] .org has been upgraded to WordPress 1.5. It’s a pretty large update, including some under-the-hood tasties I have yet to dig into. If you notice broken pages, please [...]

    Pingback from dsandler.org ≡ One Point Five on March 7, 2005

See Also:

For more WordPress news, check out the WordPress Planet.

There’s also a development P2 blog.

To see how active the project is check out our Trac timeline, it often has 20–30 updates per day.

Categories

%d bloggers like this: