[wp-trac] [WordPress Trac] #15327: Strip down admin-ajax.php to be a bare bones ajax handler.

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 24 10:17:44 UTC 2012


#15327: Strip down admin-ajax.php to be a bare bones ajax handler.
-----------------------------------+------------------------
 Reporter:  westi                  |       Owner:  kurtpayne
     Type:  enhancement            |      Status:  accepted
 Priority:  normal                 |   Milestone:  3.4
Component:  Administration         |     Version:  3.1
 Severity:  normal                 |  Resolution:
 Keywords:  westi-likes has-patch  |
-----------------------------------+------------------------

Comment (by TobiasBg):

 In the last line of the new admin-ajax.php we now send a default response
 of {{{die('-1');}}} for authenticated GET and POST requests, where before
 this has been {{{die('0');}}} (at the locations where the {{{do_action}}}
 calls were made). (However, it was {{{die('-1');}}} for nopriv requests
 already.)

 Suddenly changing from {{{die('0');}}} to {{{die('-1');}}} might break
 some plugins (which, for whatever reason, and maybe wrongly, don't set
 their own {{{die();}}}).

 For keeping backwards compatibility,
 {{{
 if ( is_user_logged_in() ) {
         do_action( 'wp_ajax_' . $_REQUEST['action'], $_REQUEST['action']
 );        // Authenticated actions
         die( '0' ); // Default status for authenticated actions
 } else {
         do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'],
 $_REQUEST['action'] ); // Non-admin actions
         die( '-1' ); // Default status for non-admin actions
 }
 }}}
 might be necessary, although a clean and consistent {{{die('-1');}}} would
 indeed be nice...

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15327#comment:25>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list