[wp-hackers] Requesting advice regarding comments form errors, accessibility and patch for http://core.trac.wordpress.org/ticket/4332

Jeremy Clarke jer at simianuprising.com
Tue Feb 23 14:52:25 UTC 2010

FWIW I think this could be one of the uses of an improved WP_Error
system overhaul. While looking into the WP_Error class to maybe use it
in the Settings API I realized that it and its uses are very haphazard
and based on specific uses rather than a holisitic plan for Errors in

This ticket is about the show_message() function, which should be part
of WP_Error but isn't http://core.trac.wordpress.org/ticket/12254

I think that if we can get all error-related stuff into the class and
build it up as a real one-stop-shop for adding, manipulating, fetching
and displaying errors (as well as adding error 'types' so it can
support red/yellow/green styles) then a lot of new uses will suddenly
appear for them. They also need some external helper functions that
make it easy to add errors into a specific error object without
globalizing it, something like:

add_error('comment_form', $code, $message, $data);

Which would find the WP_Error instance associated with 'comment_form'
and add the error to it.

IMHO WP should try to set up all systems to make it easy to add errors
in admin/plugin code that will then be displayed automatically in the
right place (i.e. your added error shows in 'admin_notices'
automatically rather than you adding a whole hook just for that).

One last thought is that, in terms of adding the errors into the theme
world which is admittedly a pretty big mess since so many people will
need to edit their themes to accommodate, it wouldn't be that hard to
achieve the right CSS as long as we stick to a simple paradigm of css
class names similar to what is used in the admin, where 'updated' is
yellow and 'error' is red. It would mean adding like 3 quick
definitions to your theme's css that would cover it, and in many cases
(like on my main site) there is already a .error class that would just
work out of the box ;)

Jeremy Clarke | http://jeremyclarke.org
Code and Design | http://globalvoicesonline.org

More information about the wp-hackers mailing list