[wp-trac] [WordPress Trac] #31206: Move AJAX action parameters out of the method body and into the declaration.

WordPress Trac noreply at wordpress.org
Tue Feb 3 21:15:15 UTC 2015


#31206: Move AJAX action parameters out of the method body and into the
declaration.
------------------------------------+------------------------------
 Reporter:  morganestes             |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  General                 |     Version:  trunk
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------

Comment (by nacin):

 The issue here is that `wp_ajax_*` hooks pass by default one argument,
 which for `do_action()` is an empty string. See #14881.

 I think we could possibly change the `add_action()` calls in `admin-
 ajax.php` to pass zero arguments.

 These functions do not actually always have a specific action. See
 wp_ajax_trash_post() versus wp_ajax_untrash_post(). I am not sure why
 wp_ajax_delete_post() uses the same style, possibly just leftover cruft.

 Hopefully this is enough background?

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


More information about the wp-trac mailing list