[wp-trac] [WordPress Trac] #41237: All error messages including core at one place

WordPress Trac noreply at wordpress.org
Wed Jul 5 13:22:15 UTC 2017


#41237: All error messages including core at one place
-----------------------------+-----------------------
 Reporter:  navalkishoregr   |       Owner:
     Type:  feature request  |      Status:  reopened
 Priority:  normal           |   Milestone:
Component:  General          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+-----------------------
Changes (by navalkishoregr):

 * status:  closed => reopened
 * resolution:  maybelater =>


Comment:

 But what is the hook to add this function. Just if we write add this
 function will we be able to get all errors that are generating.

 Replying to [comment:2 jnylen0]:
 > There is nothing stopping you from doing this in a plugin.  For example:
 >
 > {{{#!php
 > <?php
 >
 > function myplugin_get_error( $code ) {
 >     switch ( $code ) {
 >         case 'not_allowed':
 >             return new WP_Error( 'not_allowed', __( 'This operation is
 not allowed.', 'myplugin' ) );
 >         case 'not_implemented':
 >             return new WP_Error( 'not_implemented', __( 'This operation
 is not implemented yet.', 'myplugin' ) );
 >     }
 > }
 > }}}
 >
 > It's possible that a pattern like this would also be a good fit for
 parts of core.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41237#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list