[wp-hackers] Best practices for hunting depreciated functions.

Jeremy Clarke jer at simianuprising.com
Wed May 4 21:58:36 UTC 2011


Since enabling WP_DEBUG in its various forms I've had to deal with this a
lot. Here are my recommendations:


   - Use debug bar and Debug Bar Extender plugins, they are good looking and
   super useful and easy to install/use.
   - When you find WP_DEBUG errors in other people's plugins you should
   email the developer and explain how they can fix it. This can be time
   consuming as the issues involved aren't simple if the dev isn't aware of
   WP_DEBUG. On the bright side it is one of the easiest bugs they can fix :)
   - In the meantime, if a notice/error is persistent just fix it yourself
   on your copy of the plugin. It usually only takes 15 seconds to fix a
   warning once you have identified it.
   - Use a full IDE like Netbeans (which many people prefer to Eclipse
   though both have the same basic benefits) to track down usages of functions
   to find the one mentioned in the error. Like Peter said the function in the
   error is often not the location, so read the message carefully and look for
   the deprecated function instead of the file where the error was generated.
   - If your IDE can't find usages of the function in question  (or if it
   doesn't have a 'find usages' tool) then do a "search all files" for the name
   of the function without brackets. Often this will uncover instances where
   the function was registered to a hook but not called. This is good to
   remember ANY time you are looking for function usages: WP is loaded with
   functions used hundreds of times but never officially called by php code
   with ().
   - In the end the only solution sometimes is to do the bulk of your coding
   with problematic plugins deactivated. If the plugin's proper functioning is
   vital to your project then once you are done most of your coding/debugging
   you can disable WP_DEBUG and re-enable the plugin, then test the actual
   effects of the plugin to ensure it still works.


-- 
Jeremy Clarke • jeremyclarke.org
Code and Design • globalvoicesonline.org


More information about the wp-hackers mailing list