[wp-trac] [WordPress Trac] #34669: Custom back_link in wp_die and provide a filter

WordPress Trac noreply at wordpress.org
Sun Nov 15 13:32:27 UTC 2015


#34669: Custom back_link in wp_die and provide a filter
-------------------------+------------------------------
 Reporter:  eventualo    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------
Changes (by eventualo):

 * component:  Administration => General


Comment:

 I attach a patch with a suggested edit.
 I added a 4th accepted value for `$args['back_link']`:
 - `'referer'`: that shows the `wp_get_referer url`, if any, or the default
 javascript back, if not referer.

 So, in my sample scenario as explained in first post, a possible filter to
 provide a back link to reload users' page in dashboard could be:
 {{{#!php
 <?php
 function my_custom_wp_die_handler_back_link ( $back_link, $message,
 $title, $args, $referer ) {

         if ( strpos( $referer, 'wp-admin/users.php' ) !== false ) {
                 $back_link = 'referer';
         }
         return $back_link;
 }
 add_filter( '_default_wp_die_handler_back_link',
 'my_custom_wp_die_handler_back_link', 10, 5 );
 }}}

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


More information about the wp-trac mailing list